Docker Community Forums

Share and learn in the Docker community.

Convert "docker run" into "docker service create"


(Vkfont) #1

Hello.

I have trouble converting command from single “docker run” into “docker service create”, and didn’t find clear documentation about it :frowning:
Source command is: docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-docker
Target command expected: docker service create --replicas 1 --name docker-ui -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-docker

Unfortunately, was not able to find analogue for “–privleged” and “-v”, and command fail with “unknown flag” errors. Can you advice me something? Thank you :slight_smile:


(Greg Gallagher) #2

This is exactly the same issue I’m having. There is no way I can see with “docker service create” to allow the --privileged flag. Is this missing, or something intended in the design?


(Charles Vuijst) #3

For the socket mapping, you can try in a service:
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock
See definition: https://docs.docker.com/engine/swarm/services/
See other example: https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion