Issue
My docker host is Ubuntu 19.04. I installed docker using snap. I created a Dockerfile as follows:
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
I run it with this command:
sudo docker build .
I get this output:
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
Any help would be greatly appreciated!
Solution
There are several issues in your question:
Do not run docker with sudo. If your own user is not allowed to run docker, you should add yourself to the docker group:
sudo usermod -aG docker $(whoami)
Some of your
RUN
commands have no meaning, or at least not the meaning you intend - for example:RUN cd anything
will just change to the directory inside that specificRUN
step. It does not propagate to the next step. Use&&
to chain several commands in oneRUN
or useWORKDIR
to set the working directory for the next steps.In addition, you were missing the
wget
package
Here is a working version of your 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
Answered By - DannyB