Reputation: 71
I am trying to implement Watchtower which auto-build a container if any updates are found in Docker image.
These are commands I used for implementing watchtower:
git clone https://github.com/linuxacademy/content-express-demo-app.git watchtower
cd watchtower/
git checkout dockerfile
docker login -u "MYDOCKERREPO"
docker image build -t MYDOCKERREPO/my-express .
docker image push MYDOCKERREPO/my-express
docker container run -d --name watched-app -p 80:3000 --restart always MYDOCKERREPO/my-express
docker container run -d --name watchtower
--restart always
-v /var/run/docker.sock:/var/run/docker.sock
v2tec/watchtower -i 15
vi .dockerignore
Dockerfile
.git
.gitignore
#Added comment in app.js
created a sample.js file
docker image build -t MYDOCKERREPO/my-express --no-cache .
docker image push MYDOCKERREPO/my-express
I waited for many hours but no changes came. Also while pushing updated docker image it didn't show a single Pushed. All were saying 'Layers already exists"
Please if someone can help
EDIT:
Dockerfile:
FROM node
RUN mkdir -p /var/node
ADD . /var/node/
WORKDIR /var/node
RUN npm install
CMD ./bin/www
Upvotes: 0
Views: 967
Reputation: 1554
I waited for many hours but no changes came. Also while pushing updated docker image it didn't show a single Pushed. All were saying 'Layers already exists"
This means that none of the layers (changesets) you pushed differed from the ones already pushed, and as such, no new hashes were produced. Watchtower will only detect and update when the image has actual changes.
docker container run -d --name watchtower --restart always \ -v /var/run/docker.sock:/var/run/docker.sock v2tec/watchtower -i 15
The image you're using is more than a year old at this point. It might (likely won't) be compatible with current docker versions. The latest release of the watchtower image is available at containrrr/watchtower:latest
.
Upvotes: 0