Jenkins on Docker - Persist data

8/23/2016

I have a docker container with a jenkins installation. In order to persist the jenkins jobs, etc i have attached a disk and told jenkins to use it. No problem so far.

Now i have ssh into the machine to install the dotnet core cli. I have installed dotnet on the attached disk. After that a run

ln -s /dev/myDisk/dotnet/dotnet /usr/local/bin

to "register" the command. Works as expected. But if i restart the node "dotnet" is no longer in the /usr/local folder.

It makes all sense to me.

I have tried to find something but had no luck.

How can i run a script if the container starts or persist this data too ?

-- dknaack
docker
jenkins
kubernetes

2 Answers

8/23/2016

I ended up in

  • configuring my container (as before)
  • commit my changes to a new image
  • pushed the image to google container registry (docker hub would work too)
  • changed my deployment to use the new image
-- dknaack
Source: StackOverflow

8/23/2016

Changes to a running container are not committed to the image, so if you restart, the changes you made to the running container are not persisted.

You have a few options:

  1. Create a new image in which .NET core is installed

  2. Use the "official" .NET Core docker image as your base: https://github.com/dotnet/dotnet-docker

More information on Docker filesystems here: https://docs.docker.com/engine/tutorials/dockervolumes/

-- devopskata
Source: StackOverflow