Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a new docker image from a running container on Amazon?

Here is my problem:

I have a task running a Docker image on Amazon ECS but I would like to make a new Docker image from the running instance of the container.

I see the id of the instance on Amazon ECS; I have made an AMI but I would like to make a new docker image that I can pull from Amazon.

Any ideas?

Regards and thanks.

like image 986
Bussiere Avatar asked May 17 '17 14:05

Bussiere


People also ask

How do I export an image from a running container?

You can use the docker commit command to save the current state of a container to an image. You can use this image to create new containers, for example to debug the container independently of the existing container. You can use the docker export command to export a container to another system as an image tar file.

What command can create a new image from a container?

Description. The docker container create (or shorthand: docker create ) command creates a new container from the specified image, without starting it.


2 Answers

To create a image from container execute the command below:

docker commit container_id imagename

like image 178
Renato Coutinho Avatar answered Sep 29 '22 09:09

Renato Coutinho


You can run docker commit (docs) to save the container to an image, then push that image with a new tag to the registry.

like image 43
Ben Whaley Avatar answered Sep 29 '22 09:09

Ben Whaley