Dockerfile for my development tools I daily use for programming, including:
- Atom Editor
- Atom plugins for C++ / ROS
This Dockerfile includes software either downloaded outside ppa and built from
source during the image creation. This is not the cleanest solution, but without
dedicated repositories it is the only way.
The Atom and GitKraken user's configuration could be made persistent by mounting
~/.gitkraken as volumes.<br>
Note that the folder containing the atom packages will be populated with symlinks
pointing to the packages shipped with this image. If you use Atom also in your
host system, in order to keep the setups separated you can consider mounting a
different folder instead of
- Image size: 2.3GB
- Out-of-the-box development setup, quickly portable on any machine
- X11 authentication for GUIs
- User created during runtime
In order to fully exploit the Atom packages shipped with this image, it should
contain all the toolchain and libraries to build your project. For this reason,
this image could be useful as starting point to build a reproducible development
setup. Code testing could be performed with a much simpler container (or
- RTags enabled by default (package, usage - only cmake supported).
Atom could auto spawn it (check the package preferences).
- C++ linter with clang
- Many more atom plugins (check Dockerfile)
RTags work flawlessly with CMake, just add the
flag, it will generate the
compile_commands.json configuration file (reference).
RTags needs the execution of
rc -J after
clang-complete need the
.clang_complete file. Its generation
could be automated through CMake.
In order to let
linter-clang recognize C++
.hpp headers instead
~/.atom/config.cson as default configuration:
"*": "core": customFileTypes: "source.cpp": [ "h" ]
Build the image
docker build -t diegoferigo/tools .
Alternative: get the image from dockerhub
docker pull diegoferigo/tools .
This docker image allows the creation of a runtime user,
GID is 1000. Since this image contains tools that perform
operations on files shared with the host system, in order to avoid file ownership
and permission issues, I recommend to use the same username of your host user.
To override the default values and to start the container, execute:
USER_UID=1000 USER_GID=1000 USERNAME=$(whoami) docker run -i -t --rm \ -e USER_UID=$USER_UID \ -e USER_GID=$USER_GID \ -e USERNAME=$USERNAME \ --name tools \ diegoferigo/tools \ bash
Then, spawn as many ttys as needed with
docker exec -it tools bash
X11 host access
Simple example to open Atom:
XSOCK=/tmp/.X11-unix XAUTH=/tmp/.docker.xauth touch $XAUTH xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - USERNAME=$(whoami) docker run -i -t --rm \ -v $XSOCK:$XSOCK:rw \ -v $XAUTH:$XAUTH:rw \ -e XAUTHORITY=$XAUTH \ -e "DISPLAY" \ -e USERNAME=$USERNAME \ --name tools \ diegoferigo/tools \ su -c "atom -f" $USERNAME
In order to run applications as user and not root, remember to launch them with
su -c "command_to_execute" $USERNAME.
Full example to launch a persistent Atom session
XSOCK=/tmp/.X11-unix XAUTH=/tmp/.docker.xauth touch $XAUTH xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - USERNAME=$(whoami) docker run -i -t --rm \ -v $XSOCK:$XSOCK:rw \ -v $XAUTH:$XAUTH:rw \ -e XAUTHORITY=$XAUTH \ -e "DISPLAY" \ -e USERNAME=$USERNAME \ -e COPY_ATOM_PACKAGES=1 \ -v /home/diego/.atom_docker:/home/conf/.atom \ --name tools \ diegoferigo/tools \ su -c "atom -f" $USERNAME
- Explore systemd integration within container (1, 2, 3, 4)
rdmis started by atom, even if it is not the default option in
Is it worth to include systemd in the image to gracefully handle services like this?
(reference for rdm)
linter-clangshould support also the
Follow this bug report.
- It would be great to have an atom package that handles ROS / YARP in the tree view