0

I have an docker image let's say product-test:latest. Which is running in all my environments without any hurdle.But when I am pushing it to amazon-ecr and pulling it to my amazon ec2 instances and try to start the container with product-test. It's throws error like missing zip files of my product binaries in /tmp/product-*.zip. when I try to compare history(docker history product-test:latest) of both the images means ec2 and my local dev server. I get to know that there are lots of layers missing.

Here is snippet of my Dockerfile through which I am creating this image.

MAINTAINER [email protected]

ARG binaries

COPY $binaries/.m2  /root/
ADD $binaries/product-*.zip /tmp/

I have also tried with docker save -o product-test_latest.tar product-test:latest and on Amazon ec2 and load that image with docker load --input /home/centos/product-test_latest.tar but still facing the same issues. There are few things in my docker images are not coming to my amazon instance.It's really strange issue I am facing.

Amazon EC2 : docker --version: 1.12.6, build ec8512b/1.12.6

OS :CentOS Linux release 7.4.1708 (Core)

My local Dev server : docker --version: 1.13.1-cs2, build ad32da7

OS :Red Hat Enterprise Linux Server release 7.2 (Maipo)

What should be the possible issue where I should check? It will be really appreciated. Thanks

1 Answer 1

0

Using docker save and docker load commands to manage Docker images is not a recommended way. If you’re keen on security and don’t want to push your images to Docker Hub, then consider creating a private Docker repository or push images to ECR. The created TAR file flattened and missed some meta-data.

Best practice will be:

  • Create a Private Docker registry or use ECR

  • Build a Docker image with your static files and any custom binaries

  • Push the Docker image to your private registry or ECR

  • On EC2, pull the image from Private Docker registry or ECR.

In this way you avoid Docker filesystem layer issues encountered when using docker save and docker load commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .