1

https://github.com/darkdragon-001/Dockerfile-Ubuntu-Gnome

This is the command which is adding capabilities to the docker run command of the ubuntu gnome container. I want this --cap-add to be automated rather than typing in the command manually each time. Any suggestions or links or reference?

sudo docker run --name=ubuntu-gnome -d --rm \
  --tmpfs /run --tmpfs /run/lock --tmpfs /tmp \
  --cap-add SYS_BOOT --cap-add SYS_ADMIN \
  -v /sys/fs/cgroup:/sys/fs/cgroup \
  -p 5901:5901 -p 6901:6901 \
  darkdragon001/ubuntu-gnome-vnc
Thanh Nguyen Van
  • 10,292
  • 6
  • 35
  • 53
  • You can use [docker-compose](https://docs.docker.com/compose/). This configuration will be coded in the composer files and you will not need to type this complex command each time. – Davide Madrisan Oct 04 '21 at 12:29
  • The capabilities are used at runtime so it's not possible to set them in the Dockerfile. This [post](https://stackoverflow.com/questions/50819439/assigning-additional-capabilities-using-a-docker-file) should give you some hints. – Davide Madrisan Oct 04 '21 at 12:32
  • You cannot write a Dockerfile that gives itself permissions to root the host. If you need this low-level access (and a display) you might consider whether a virtual machine is a better match for your application. – David Maze Oct 04 '21 at 12:58
  • Hi I am kind of newbie to this. I am using compose to do this all. can anyone refer me or tell how to write for --tmpfs /run --tmpfs /run/lock --tmpfs /tmp \ into docker-compose – Nipun Sharma Oct 05 '21 at 05:11

0 Answers0