Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Empty build directory using docker build
Empty build directory using docker build [message #1779886] Mon, 15 January 2018 10:59 Go to next message
Bernd Doser is currently offline Bernd DoserFriend
Messages: 3
Registered: January 2018
Junior Member
I running eclipse 4.7.2 within a docker container. The directory for the workspace /home/eclipse is mounted from a docker volume. The docker host is mounted with /var/run/docker.sock:/var/run/docker.sock. If I build a managed C++ project the workspace and the build directory will be automatically mounted via /home/eclipse/eclipse-workspace/hello:/home/eclipse/eclipse-workspace/hello and /home/eclipse/eclipse-workspace/hello/Debug:/home/eclipse/eclipse-workspace/hello/Debug, respectively. Since the directory /home/eclipse is not available at the host, but only in the eclipse docker container, the mounted directories in the build container are empty.

I have tried to mount an additional volume using a data container for /home/eclipse, but due to the nested mount points of the workspace and build directory the directories within the build container are still empty.

Is it possible to switch off these automatic mount points or to use a docker volume instead of a host path?
Re: Empty build directory using docker build [message #1780603 is a reply to message #1779886] Wed, 24 January 2018 14:15 Go to previous message
Bernd Doser is currently offline Bernd DoserFriend
Messages: 3
Registered: January 2018
Junior Member
Let me explain my issue a bit more. I know two ways to use docker within a docker container:

1. Running a docker daemon within the docker container. The build containers will start as childs. You can try it out by running
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix:ro -e DISPLAY bernddoser/docker-devel-cpp:ubuntu-16.04-cmake-3.10-gcc-7-conan-1.0-docker-17.12-eclipse-4.7.2


2. Mounting the docker socket /var/run/docker.sock into the docker container. The build containers will start as siblings.
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v /var/run/docker.sock:/var/run/docker.sock -e DISPLAY bernddoser/docker-devel-cpp:ubuntu-16.04-cmake-3.10-gcc-7-conan-1.0-docker-17.12-eclipse-4.7.2


In both cases you must allow your host to display the container before you start the eclipse containers. For ubuntu I use
xhost +local:


The common opinion is that option 1 should be avoided and option 2 is the method of choise https://stackoverflow.com/a/33003273/6379984. Option 1 is working because the workspace mount point is available within the eclipse docker container, whereas option 2 is not working because the workspace is not available at the docker host. I would prefer option 2. My first impression using option 1 is also, that it works really slow. Is it somehow possible to use option 2?

Please find more about my docker C++ build environments at https://github.com/BerndDoser/docker-devel-cpp

What are your experiences with docker build environments?
Previous Topic:Remote debugging
Next Topic:Indexer Build Output Parser and different build directories
Goto Forum:
  


Current Time: Sun Aug 19 19:04:02 GMT 2018

Powered by FUDForum. Page generated in 0.01599 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top