Docker pushing containers to private registry

I have an app which uses several docker containers:

  1. NGINX container
  2. NodeJS sails app container
  3. Redis cache container

Since I’m using existing images for two of the above containers, I also have two cached containers:

  • Dynamically serving django docker containers
  • How to integrate spark cluster with other Hadoop2.x cluster on Docker
  • Run docker in shell using PHP
  • How to mount host directory in docker container?
  • How to setup docker to use cache from registry on every build step
  • Setting up ReactJS in windows 10 giving error
    1. alpine
    2. redis

    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 🙂

  • Redirecting all requests of one docker container to another ??
  • Create docker base image for a linux iso image
  • Docker container doesn't start, showing as 'Exited n seconds ago'
  • `data-container` with named or anonymous volumes - conceptual problems? (Discussion)
  • ECS Docker Container get env variable running cron
  • Host name does not match the certificate subject provided by the peer, but it's a perfect match
  • 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?

    You don’t.

    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 Dockerfile.

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.