In this blog I will udpate the pakage using yum. I will be installing httpd and telnet and will build a new image.
I will be using CentOS. Follow the below steps
[user@mytest:~]$ docker run -it centos:centos /bin/bash
(Output)
[root@b237d65fd111 /]#
(Output)
[root@b237d65fd111 /]# yum -y update (or yum -y upgrade)
(Output)
List of packages needing update and being applied here
(Output)
[root@b237d65fd111 /]# yum install httpd
(Output)
[root@b237d65fd111 /]# yum install telnet
(Output)
[root@b237d65fd111 /]# service httpd start
(Output)
httpd start [OK]
(Output)
[root@b237d65fd111 /]# telnet localhost 80
[root@b237d65fd111 /]# exit
[user@mytest:~]$ docker ps -a
(Output)
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b237d65fd111 centos “/bin/bash” 2 minutes ago Exited (0) 2 minutes ago fus_tim
[user@mytest:~]$ docker commit b237d65fd111 newcentos:withapache
(Output)
18bd1fc4d60fa29ff9591f46b86ea0ad7652214d81b4e26343711edfdbeed8a
[user@mytest:~]$ docker images
(Output)
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
newcentos withapache 18bd1fc4d60f 4 seconds ago 420.5 MB