Deploy centos7 image in docker

This article is referenced from:

https://www.cnblogs.com/linjj/p/5606911.html

https://blog.csdn.net/u012767761/article/details/78107870

1. Install Docker for Windows, click https://store.docker.com/editions/community/docker-ce-desktop-windows to download

2. To build a centos7 image library, you can go to Netease Honeycomb and select a copy of the Dockerfile at https://c.163yun.com/hub#/m/repository/?repoId=1055

3. Put the copied content into the newly created Dockerfile file, this file needs to be created by yourself, but be careful not to add a suffix to this file

Here is what I copied:

FROM hub.c.163.com/public/centos:7.2.1511
RUN yum clean all
RUN yum install -y yum-plugin-ovl || true
RUN yum install -y vim tar wget curl rsync bzip2 iptables tcpdump less telnet net-tools lsof sysstat cronie python-setuptools
RUN yum clean all
RUN easy_install supervisor
RUN cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EXPOSE 22
RUN mkdir -p /etc/supervisor/conf.d/
RUN /usr/bin/echo_supervisord_conf > /etc/supervisord.conf
RUN echo [include] >> /etc/supervisord.conf
RUN echo 'files = /etc/supervisor/conf.d/*.conf' >> /etc/supervisord.conf
COPY sshd.conf /etc/supervisor/conf.d/sshd.conf
CMD ["/usr/bin/supervisord"]

4. Create a folder, put the Dockerfile file in the folder, use cmd to open the command line, switch to the Dockerfile file, and execute the following program:

docker build -t docker-whale .

(note there is a dot here, don't forget it)

5. Wait for the script in the Dockerfile to execute. After execution, enter docker images on the command line to view the newly configured centos7 image.

6. Enter in the consoledocker run -ti <镜像ID> /bin/bash,即可进入centos7操作系统了

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325212044&siteId=291194637