I’m going to first provide the background, so bear with me for a minute.
I’m using systemd on a CentOS box to run a few different docker images. One of them is “out of the box” from Docker Hub, and the other are custom images that I built and uploaded to our enterprise docker registry.
I have an automated build process for the custom images (really based on a single Dockerfile, with varying parameter sets). It builds the image, uploads to our registry, then essentially calls “docker stop” (through ssh) on the container name, which causes the container to exit, and then systemd restarts the service, which causes the updated image to be pulled down.
Yesterday I decided to change the image name, because I had changed the image it was based on. After rebuilding and redeploying everything, I saw that the attempt to get the new image was failing, for “authorization” reasons.
This reminded me of “docker login”, which I hadn’t even looked at for several weeks. When I executed that, and entered my credentials for the enterprise docker registry, I was then able to pull the new images.
This is obviously a flaw in my automation process, but it’s something that’s not going to cause a problem very often, just often enough for me to forget it about it until the next time I have to do it.
Is there something I should do to clean up this process? I find it hard to believe that I would need to hardcode my user/password for “docker login” in the systemd script (I at least have a “service” account for this). Is that really what I would have to do to fully automate this?