Sign inSign up

archananagaraj/demo_builddockerimage

By archananagaraj

•Updated over 7 years ago

Demo to show how to build a docker image by committing changes made in a docker container

Image
0

93

archananagaraj/demo_builddockerimage repository overview

Step 1:

docker run -it ubuntu:xenial --> run ubuntu:xenial from docker hub. Confirm for git not installed.

docker commit c3ddeea9d77d archananagaraj/demo_builddockerimage:ubuntuXenialwithnoGit. --> commit and push the image to the repository with a tag OR you may use docker tag command to tag your image

docker push archananagaraj/demo_builddockerimage:ubuntuXenialwithnoGit


Step 2:

docker run --it archananagaraj/demo_builddockerimage :ubuntuXenialwithnoGit. --> Run the ubuntu image from the docker hub repo pushed in the above steps

apt update && apt install -y git. --> install updated version of git using apt package manager

git. --> confirm git is installed by checking the version

docker ps -a --> get the container id of the image

docker commit 88f0e5382d65 archananagaraj/demo_builddockerimage:ubuntuXenialwithGit. --> commit the changes with a new tag( git installation is the change) OR you may use docker tag command to tag your image

docker push archananagaraj/demo_builddockerimage:ubuntuXenialwithGit. --> push the changes to docker hub repo


Note: In both the steps note the size of the images.

Archanas-MacBook-Air:~ archananagaraja$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE archananagaraj/demo_builddockerimage ubuntuXenialwithnoGit 91b5c8714391 2 hours ago 120MB

Archanas-MacBook-Air:~ archananagaraja$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE archananagaraj/demo_builddockerimage ubuntuXenialwithGit c1c68ba98376 11 minutes ago 236MB

Tag summary

Content type

Image

Digest

Size

92.5 MB

Last updated

over 7 years ago

docker pull archananagaraj/demo_builddockerimage:ubuntuXenialwithGit