Docker Community Forums

Share and learn in the Docker community.

Convert “docker run cmd” into “docker service create”

swarm

(Serenabi) #1

I have a docker run with additional CMD, I don’t know how to cover it to docker service create in swarm
for example: i have no idea how to pass a cmd to my consul service, any one can help me on this?

docker service create
–name consul-bootstrap
–replicas 1
–container-label consul-bootstrap
–publish mode=host,target=8500,published=8500
–mount type=volume,volume-driver=cloudstor:aws,source=dev-{{.Service.Name}}-{{.Task.Slot}}-vol,destination=/var/lib/mysql/data,volume-opt=backing=relocatable,volume-opt=size=0.5,volume-opt=ebstype=gp2
*–command consul agent -server -bootstrap-expect=3 -data-dir=/export/consul/data -ui -client 0.0.0.0 -bind ‘{{ GetInterfaceIP “eth0” }}’ *
consul-server:1.2.1


(Etienc) #2

Image name needs to be before the command, and you don’t need —command