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:

  • failed to set the password using the given URL when using docker to create admin
  • Always ask password on local file when modified file when ran docker container
  • Deploy a Dockerized Symfony2 application on AWS Elastic Beanstalk
  • How to pass parameter into docker container and update file in container with passed parameter
  • Can not register more than one subdomain this nginx and nginx-proxy with docker container
  • How to start another bash in Dockerfile
    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 🙂

  • Easiest way to deploy with docker-compose?
  • Docker consumer on AWS while using RabbitMQ
  • Rancher OS: generate data in one container and set as environment variable in another container
  • Kubernetes pods versus Docker container in Google's codelabs tutorial
  • docker java7 install fail
  • docker-compose not recognizing env_file file/location, and still tries to use the default .env
  • 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.