I am using Docker container for managing my Application. I have deployed the Application at Multiple Servers.
Now I want to update that Application on all my servers. Thus I am looking for a solution to automate the deployment process.
What I have done so far to achieve this =>
I have configured a docker registry on a Server ( Main Server from which all the clients will pull the images ). I have tested pull and push from the client side and it is working properly.
But the problem here is that I have to manually pull the application on all the client side from the docker registry.
I found some open source implementation for this purpose ( WatchTower and ouroboros ) But according to my understanding, this solution needs registry as DockerHub or private registry hosted by Docker. ( Please correct me if I am wrong )
Question:
In my scenario, I am hosting the Docker Registry at my private server. So I am looking for the solution that can detect the changes in the Registry an automatically update the Container ( i.e. Application )
If pulling images from private Docker registries, supply registry authentication credentials with the environment variables REPO_USER and REPO_PASS or by mounting the host’s docker config file into the container (at the root of the container filesystem / ).
They refer to a registry for Docker images. This is a category and not a brand or specific product. Your image repo could be anything: Gitlab, Nexus3, Artifactory, Quay.io, Portus, DTR, Registry2,… and it should work as far as you follow the documentation on how to pass the credentials into watchtower.
If your deployments are Swarm deployments, you would want to use Docker instead of watchtower.
update: according the documentation of ouroboros, it supports plain containers and swarm services as well.
Actually, I am not sure if I came up with the right conclusion that’s why I said this.
Anyways thanks for the response and clarification. To test this theory I did following steps =>
I have configured the docker at my server. After that, I have configured my container ( i.e. My Application ) on the device and I am using docker-compose for building my application.
Now I logged into my Private Docker Register ( It is hosted at another server ) using the following command docker login <URL_of_my_private_registry> from the server on which I have my application which needs to be updated. I made sure that before login there was nothing related to docker at this path ~/. Once I logged in I got a config.json inside this directory. Inside the config.json file, I have auths and httpheaders JSON.
Now for configuring the WatchTower, I have used the following command =>
-e REPO_USER=username \ In this command I have replaced username and password with the username and passwword that I have configured for the Registry.
Now when I checked the logs of my WatchTower using docker logs -f <container-id> I got the following output.
time="2019-07-02T07:14:54Z" level=debug msg="Sleeping for a seconds to ensure the docker api client has been properly initialized."
time="2019-07-02T07:14:55Z" level=debug msg="Retrieving running containers"
time="2019-07-02T07:14:55Z" level=debug msg="There are no additional watchtower containers"
time="2019-07-02T07:14:55Z" level=debug msg="Starting Watchtower and scheduling first run: 2019-07-02 07:15:10 +0000 UTC m=+15.597435652"
time="2019-07-02T07:15:10Z" level=debug msg="Checking containers for updated images"
time="2019-07-02T07:15:10Z" level=debug msg="Retrieving running containers"
time="2019-07-02T07:15:10Z" level=debug msg="Scheduled next run: 2019-07-02 07:15:25 +0000 UTC"
But when I check my docker registry logs I am unable to see any log related to this polling.
That’s Why I came up with this conclusion. Anyways can you please tell me what I have done wrong here in the configuration.
I guess there is a difference between mounting the config.json and passing the username and password. The config.json does include the domain name of the registry as well.
If you performend docker login <URL_of_my_private_registry> as root and started a compse stack that looks similar like this:
I would assume that things should work. Watchtower pulls the image and compares the image id with the running container with the latest pulled image’s image id. The repository domain name is included in the image attribut. The config.json includes a valid token or the credentials for the same domain name. This should work.