Delete folder in container: /sobey, based on dockerfile implementation

新增加一行:RUN rm -rf /sobey。Dockerfile 的内容如下。
1. The content of the Dockerfile is as follows


FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx:2.2.20

MAINTAINER shuijingwanwq@163.com

COPY code /mcloud/www/pcs
COPY code/build_docker/c_files/ /

RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf


2. Since there are directories in the basic image: /sobey/www, and it is a blank directory, it is no longer needed. The basic image cannot be upgraded for a while, so I decided to delete the folder in the Dockerfile: /sobey. as shown in Figure 1
由于基础镜像中存在目录:/sobey/www,且是一个空白的目录,现在已经不需要了。而基础镜像一时之间还无法升级,决定在 Dockerfile 中删除文件夹:/sobey。
Figure 1
3. Add a new line: run rm -rf /sobey. The content of the Dockerfile is as follows. as shown in Figure 2
新增加一行:RUN rm -rf /sobey。Dockerfile 的内容如下。
Figure 2


FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx:2.2.20

MAINTAINER shuijingwanwq@163.com

COPY code /mcloud/www/pcs
COPY code/build_docker/c_files/ /

RUN rm -rf /sobey

RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf


4. Check the build output of the container. It runs normally. as shown in Figure 3
查看容器的构建输出。运行正常。
Figure 3


Step 5/6 : RUN rm -rf /sobey
 ---> Running in 2bf756e0c68e
 ---> ff2ba07c5178
Removing intermediate container 2bf756e0c68e


5. Enter the container, directory: /sobey no longer exists. in line with expectations. as shown in Figure 4
进入容器,目录:/sobey 已经不存在。符合预期。
Figure 4

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.