![]() Status: Downloaded newer image for :5000/locotech/buildchaintest:0.1.8-dev However the output of the pull command would suggest that a new version of the image was fetched: Pulling application (:5000/ourcompany/buildchaintest:latest). In a folder on my computer, where the contents is only the docker-compose.yml and the necessary Dockerfiles to build the nginx and php services, the output I get is not the latest version number as has been tagged in the registry or is shown in the docker-compose.yml (0.1.8), but the version before that, which is 0.1.7. If I now run docker-compose pull & docker-compose -f docker-compose.yml up -d This seems to be doing what it's supposed to be since I get a new version tag in our repository each time the build completes and the version nr has been bumped. On our jenkins server I run the following to build and tag the image cd $WORKSPACE & PROJECT_VERSION=$(cat VERSION)-devĭocker tag :5000/ourcompany/buildchaintest :5000/ourcompany/buildchaintest:$PROJECT_VERSIONĭocker push :5000/ourcompany/buildchaintest Image: :5000/ourcompany/buildchaintest:0.1.8-dev OS: tested on both CentOS 7 and OS X 10.10 using docker-toolbox The version nr is displayed if I browse to the nginx server that is created (this works as expected locally). I created a simple test project for this in which the only goal is to get a version nr to increase on each new build. I would like for compose only to detect the new version of the changed images, pull them and then restart the services with those new images. ![]() I looked at How to get docker-compose to always re-create containers from fresh images? which seemed to be similar to my issue, but none of the provided solutions there work for me, since I'm looking for a solution I can use on the production server and there I don't want to be removing all containers before starting them again (possible data loss?). It looks like compose is using the previously started image even though docker-compose pull has fetched a newer image. If the commands in my script won't really work in this case what is a better way to do this?Įdit: Sorry should have been more clear when I loop through the changed files I need to pull the changes from the remote repository before I loop through the files so that when I work with these files I have the latest changes.I don't know what I'm doing wrong, but I simply cannot get docker-compose up to use the latest image from our registry without first removing the old containers from the system completely. How can I assign the variables output from the command to see the changed files to an array so that I can loop through them using a for?.How can I get a git command like this or other git commands to return the right responses in an if statement? It seems that git does not work like normal shell commands where you get a 0 or 1 response. I have tried if statements with other git commands and they also are always true. The if statement to check if there are changes or not always is true.The things that I have not been able to get working with the commands in this script are: Git -git-dir="/dir/.git" diff -name-status ORIG_HEAD. #Output the modified files from the last pull If git -git-dir="/dir/.git" log HEAD.origin/master -oneline Here is a script with some of the commands that I have: #!/bin/sh Through my research I have found some of the necessary commands to do these things but I haven't been able to get them to work together in a shell script. Loops through the files that are new or have been modified.If there are changes in the remote git repository pull those changes.Checks the remote git repository for any changes to pull.I am trying write a shell script that does the following:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |