Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose and user namespaces

It is known how to use user namespace with docker. Is it possible to use it with docker-compose? I mean:

service:
  - user-namespace: true

or someting like that?

like image 344
asdas Avatar asked Sep 02 '26 07:09

asdas


2 Answers

There doesn't seem to be an option to active user namespace in docker compose. There is the userns_mode property which can be used to disable user namespace using userns_mode: "host"

The username space feature can be enabled on the docker deamon which will be used by docker-compose when starting the containers.

like image 123
yamenk Avatar answered Sep 05 '26 09:09

yamenk


User namespaces are configured at the docker daemon level, not on individual containers. There's no option to opt an individual container into user namespaces. The most you can do is disable user namespaces for a single container when the daemon is running with user namespaces by setting --userns to 'host', or in compose to set userns_mode: host. Since docker-compose and docker stack deploy are used to configure containers and not the daemon, there's no option to enable this setting from your docker-compose.yml.

like image 28
BMitch Avatar answered Sep 05 '26 10:09

BMitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!