Docker pushing containers to private registry
I have an app which uses several docker containers:
- NGINX container
- NodeJS sails app container
- Redis cache container
Since I’m using existing images for two of the above containers, I also have two cached containers:
I’m trying to push my containers (1, 2, & 3) to AWS Elastic Container Registry (ECR). I’ve been able to do this, but have noticed that my cached containers (4 & 5) get pushed too.
I’m building the containers using
docker-compose, and then tagging like so:
docker tag -f nodejs_app:latest <repository URL>:latest
After logging into ECR with
docker login, I push using this command:
docker push <repository URL>:latest
Docker then pushes all 5 containers up into the registry. How do I only push the containers that I care about and not the cached ones too?
Thanks in advance 🙂
One Solution collect form web for “Docker pushing containers to private registry”
How do I only push the containers that I care about and not the cached ones too?
Docker images (not containers; a container is what you get when you boot an image) are built from layers. Your
nginx image, for example, consists of all the layers from the
alpine image, followed by any layers that are created as the result of your
In order for your new image to be stored in a private repository, all the underlying layers need to be available. This means that in addition to the layers you create via your
Dockerfile, all the layers from the
alpine image also need to be pushed to the repository as well.
So if you build an image on top of the
alpine image and push it to a private repository, the
alpine image will get pushed there as well.