我正在尝试配置Nginx,但是配置丢失了;所以我尝试重新创建一个新的容器;但是,不管我做什么。新容器将启动,并具有旧容器的旧配置。
下面是我删除旧容器并启动新容器的过程。
sudo docker container rm -f xxxx
sudo docker system prune --volumes
sudo docker system prune
sudo systemctl stop docker
sudo systemctl start docker
sudo docker run --detach \
--hostname xxx \
--publish xxxxx \
--name the same old name or new\
--restart always \
--volume xxxxx \
xxx/xxx-xx:latest
sudo docker exec -it xxx /bin/bash
我之前创建的每个文件夹和配置仍然在那里。我做错什么了吗?
发布于 2019-09-29 19:42:02
原因是--volume xxxxx
参数。您应该删除该卷,并创建一个新卷,如果这是您的应用程序中需要的:
docker rm -f container_name
docker volume rm -f volume_name
docker volume create new_volume
docker run --detach \
--hostname xxx \
--publish xxxxx \
--name container_name \
--restart always \
--volume new_volume \
xxx/xxx-xx:latest
https://stackoverflow.com/questions/58150493
复制相似问题