blacklabelops-legacy / jenkins

Docker Jenkins Swarm-Ready with HTTPS
https://hub.docker.com/r/blacklabelops/jenkins/
MIT License
108 stars 36 forks source link

Data Container not working with compose #5

Closed crisp2u closed 8 years ago

crisp2u commented 8 years ago

Hi guys,

I'm kind of new into docker and especially data only containers. I noticed that if I ran your docker-compose example I noticed that the data container is not mounted. I kind of think is because the compose rebuilds the container every time and not in the right order. Any idea what's happening ?

blacklabelops commented 8 years ago

Hello,

Thanks for reporting this issue!

You can inspect the data container with:

$ docker run -it --rm -volumes-from jenkins_data blacklabelops/centos bash
$ cd /jenkins

Or by copying some folder from the data container:

$ docker cp jenkins_data:/jenkins ./backups

The /jenkins folder should not be empty and contain the latest config. I have checked with docker-compose.yml in my repository. I am using both MacOS and CentOS hosts.

If the error still occurs then please list your system settings and describe the problem in more details.

blacklabelops commented 8 years ago

Side-Note: The data inside the data container is safe as long the container is never removed! You will lose the data with:

$ docker-compose rm

or

$ docker rm jenkins_data

If you want to safely replace the jenkins container without affecting the data container then just put the data container definition in a separate file docker-compose-jenkins-data.yml.

Control the data container with:

$ docker-compose -f docker-compose-jenkins-data.yml <your-command-here>
crisp2u commented 8 years ago

Silly me. I was doing docker-compose run volumes ls -la /jenkins to check the data container which I guess is not the same. Still a lot to learn and understand about data containers ....

blacklabelops commented 8 years ago

Ah I see,

You can check Ids and names with:

$ docker-compose ps

docker-compose always takes the id of the docker-compose.yml specifications and adds a number, e.g. volumes_1, volumes_2, volumes_3. So you will never see a data container with the name "volumes".

Inside my specification I use "container_name: jenkins_data". This way the container always gets the same container-id but on the other hand its not scaleable because the name-tag limits the instances to one only. This is in my case okay as the jenkins container can also only be started once without changing the port. Also the data container should only have one instance!

Best regards, Steffen