Answer the question
In order to leave comments, you need to log in
How to make Docker work non-root?
I work on the server not as a root user, the user is added to the Docker group. As a user, I can create and run containers without sudo. But when forwarding directories from docker, the directories are created with the owner root and because of this, working in them is difficult. How to make folder owner be user?
More:
docker run -d \
-p 80:80 \
--name nginx \
--restart always \
-v /home/server/nginx/html:/usr/share/nginx/html \
-v /home/server/nginx/nginx.conf:/etc/nginx/nginx.conf:ro \
nginx
Answer the question
In order to leave comments, you need to log in
For example like this:
FROM ubuntu:xenial
RUN useradd -d /home/ubuntu -ms /bin/bash -g root -G sudo -p ubuntu ubuntu
RUN mkdir /opt/myvolume && chown ubuntu /opt/myvolume
WORKDIR /home/ubuntu
VOLUME /opt/myvolume
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question