Docker Community Forums

Share and learn in the Docker community.

Amazon EC2 AMI fails to run docker image

Expected behavior

The docker image runs

Actual behavior

when I run docker:

nsfcareer.ami latest f9d5e2f9b62d 6 minutes ago 5.15GB
amazonlinux 2 b94321659aca 3 months ago 162MB
[ec2-user@ip-172-31-55-132 ~]$ docker run -it f9d5e2f9b62d

Nothing happens. It just goes back to the command prompt. Also, it does not give me any information about what is going on, or why it will not load.

Additional Information

I have plenty of space (I thought that might be the issue but I have 100 GB of storage on the instance). I tried to set -D option to get more information but it did not give any further information.

I can successfully push the image, but I want to load it after it builds. Process works fine when building on a AWS Ubuntu instance. My issues is with the AMI instance types.

Steps to reproduce the behavior

This seems to happen when the docker images start to get big (?, maybe for 1 GB - a guess). I did not have issues for smaller images.

  1. Create AWS AMI image (t2.2xlarge with 100 GB of storage)
  2. Pull docker image (sudo docker pull rhk12/nsfcareer.ami:latest)
  3. Try to run docker image (sudo docker run -it f9d5e2f9b62d )

In my case it just goes back to command prompt. I was expecting that it would load the image and take me to home directory.

Thanks for any help you might be able to offer.

Interestingly, when I try to run the image with:
docker run -it IMAGE_ID

it hangs for a few seconds and then gives back to the prompt, as I described previously. However, if I give a ctrl-c at the command prompt while it is trying to run the docker, then it works. Meaning it loads the image which I can see at the prompt.

I think the issue was related to a bashrc file file that I was using as part of the docker image. Once I updated that with the same content as AWS AMI instances, it has been behaving better. The old bashrc was originally from a ubuntu instance.