Docker – 03- Building Docker Images (Interactively)

docker-image

We can build docker image with commit

  1. We create container with base ubuntu image

docker run -it ubuntu bash

apt-get install wget

apt-get install curl

docker ps -l

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80a2df5a4a68 ubuntu:latest “bash” 4 minutes ago

You must be see created container id  and we can see diff before and last state

docker diff 80a2df5a4a68

We are commit changes to container

docker commit 80a2df5a4a68

And its give to us new container ID

390bfd8d4b35

docker run -it 390 bash

And you can check curl and wget theese must be installed to new container

We can set the tag name created image with image id or  we can set when creating

docker commit d09e4ad2912b myimage

docker tag d09e4ad2912b myimage

docker images

You must see

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
myimage latest d09e4ad2912b 2 minutes ago

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s