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:

  • How to create privilege (per user) in Kibana
  • How to set RAM memory of a Docker container by terminal or DockerFile
  • Docker on Windows (Boot2Docker) - certificate signed by unknown authority error
  • Docker access localhost
  • How to install ffmpeg for ubuntu using command line?
  • --add-host parameter in Marathon docker application
    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 🙂

  • Docker-compose linking service into dockerfile
  • Update & Upgrade Docker distribution on Windows
  • Recover Percona Xtradb in container
  • Does 'docker start' execute the CMD command?
  • Unable to start Docker Container with ONOS
  • How to set environment variables via env-file
  • 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.