Docker Community Forums

Share and learn in the Docker community.

Root permissions for user inside a Docker container

docker

(Predi) #1

Hey there,

recently I have been working a lot with Docker. I am going to replace the apache deployment process with a newer one using Docker. The idea is to have the binaries on a share that I map by using "docker run -v /host-mountpoint:/container-mountpoint.
I run a bash afterward inside the container as my personal user "docker exec -it -u=[myusr]:[mygrp] [container id] /bin/bash. I cannot run the container as root beacause it does not have permssions to access the network share-
The problem is the following one: If i want to start the apache webserver it turns out, that my user does not have the permissions to map the ports:

Is it possible to provide root permissions to my personal user inside the Docker container or is there an other way to work around my problem?

I run centos 7.1 on my host and in my container.

Thanks for you help

cheers
P.


(Vincenzo Melandri) #2

I do not understand what you’re trying to do.
Seems to me you’re trying to use the docker container as if it was a virtual machine, or a lxc container, spawning services on it whe it’s already running. That on my understanding you should not.
You should only run one service inside a docker (you can have more, but it’s bad practice), the ports should be mapped in the Dockerfile build file, as the service you run should be specified there, and you should map the host ports to the container when you run it.
Right? :confused: