我的docker主机是Ubuntu 19.04。我用snap安装了docker。我创建了一个Dockerfile,如下所示:
FROM ubuntu:18.04
USER root
RUN apt-get update
RUN apt-get -y install build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
RUN wget http://nginx.org/download/nginx-1.15.12.tar.gz
RUN tar -xzvf nginx-1.15.12.tar.gz
RUN cd nginx-1.15.12
RUN ./configure --sbin-path=/usr/bin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-pcre --pid-path=/var/run/nginx.pid --with-http_ssl_module
RUN make
RUN make install
我用这个命令运行它:
sudo码头工人建造。
我得到这个输出:
Sending build context to Docker daemon 3.584kB
Step 1/10 : FROM ubuntu:18.04
---> d131e0fa2585
Step 2/10 : USER root
---> Running in 7078180cc950
Removing intermediate container 7078180cc950
---> 2dcf8746bcf1
Step 3/10 : RUN apt-get update
---> Running in 5a691e679831
OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:109: jailing process inside rootfs caused \\\"permission denied\\\"\"": unknown
任何帮助将不胜感激!
您的问题有几个问题:
sudo usermod -aG docker $(whoami)
RUN
命令没有意义,或者至少没有你想要的意思 - 例如:RUN cd anything
只会改变到特定RUN
步骤内的目录。它不会传播到下一步。使用&&
在一个RUN
中链接几个命令或使用WORKDIR
为后续步骤设置工作目录。wget
包这是Dockerfile的工作版本:
FROM ubuntu:18.04
RUN apt-get update && apt-get -y install \
build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev wget
RUN wget http://nginx.org/download/nginx-1.15.12.tar.gz
RUN tar -xzvf nginx-1.15.12.tar.gz
WORKDIR nginx-1.15.12
RUN ./configure \
--sbin-path=/usr/bin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-pcre \
--pid-path=/var/run/nginx.pid \
--with-http_ssl_module
RUN make && make install