Manually install Linux commands

Download a CentOS Image

docker pull centos
Copy the code

Start a centos container

docker run -it --name mycentos01 5d0da3dc9764 /bin/bash
Copy the code

Viewing the CentOS Version

Cat /etc/redhat-release //CentOS Linux release 8.4.2105Copy the code

The basic commands in centos cannot be used

Clear // Clear the screen vim // Text edit ifconfig // Display or configure network devicesCopy the code

Manual installation commands

Yum -y install vim // Install text editing command yum install -y net-tools // Install display or configure network devices command yum install -y ncurses // install clear screen commandCopy the code

The command is installed successfully. The test is ok

Create a CentOS image using Dockerfile

Write dockerfile

FROM centos
MAINTAINER sunjiedgsun

ENV MYPATH /usr/local
WORKDIR $MYPATH

RUN yum -y install vim
RUN yum install -y  net-tools
RUN yum install -y  ncurses

EXPOSE 80

CMD /bin/bash
Copy the code

Generate the mirror

Docker build -f dockerFile01 -t mycentos:1.0.0Copy the code

View the history of creating a mirror

docker history 1bf47dff9310
Copy the code

You can use the image you just generated, start a container, and test related commands