Step1 : search the Docker Hub for ‘centos’ image
Step2 : download official ‘centos’ image
Step3 : Run a container using the ‘centos’ image
Step4 : Get an interactive shell on the ‘centos’ container
Step5: create a new container with custom packages
First make a change
[root@82dd093e740d ~]# yum install httpd
[root@82dd093e740d ~]# exit |
[root@82dd093e740d ~]# yum install httpd
[root@82dd093e740d ~]# exit
Then commit
docker commit -m "pretty commit message" -a "author name" 82dd093e740d centos-with-httpd |
docker commit -m "pretty commit message" -a "author name" 82dd093e740d centos-with-httpd
Note: 82dd093e740d is the container-id (we can got it using ‘docker ps’ the the container runs).
Step6: That’s it !’
docker images
[root@localhost opt]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos-with-httpd latest c5135e3e3ee5 40 minutes ago 313MB |
docker images
[root@localhost opt]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos-with-httpd latest c5135e3e3ee5 40 minutes ago 313MB