Reputation: 125
I just want to create a service on Docker Swarm with NGINX and to make data persistent after docker-machine reboot.
I check the manager IP
docker-machine ip manager
Then I go to the machine
docker-machine ssh manager
Inside a Docker Machine I create a new service:
docker service create -p 80:80 --mount type=volume,target=/usr/share/nginx/html --name nginx nginx
Here I expect to have a service running with NGINX on the port 80 with an unnamed volume.
In a web browser I see that NGINX is online at MANAGER_IP:80.
With docker inspect CONTAINER_ID
can find the path to the volume and to modify e.g. index.html
.
But after docker-machine stop
and docker-machine start
my change disappears.
Why? What do I have to do to make it persistent (to be available after rebooting docker-machine) ?
Any advice much appreciated.
Upvotes: 0
Views: 131
Reputation: 131
can you try this
docker service create -p 80:80 --mount type=volume,source=myvolume,destination=/usr/share/nginx/html --name nginx nginx
You just didn't mention the source in your command
Upvotes: 1