Mode 1 : Modify configuration file ( Need to stop docker service )
1, stop it docker service
systemctl stop docker.service( crux , Must stop before modifying docker service )
2,vim /var/lib/docker/containers/container-ID/config.v2.json
Modify the directory location in the configuration file , Then save and exit

"MountPoints":{"/home":{"Source":"/docker","Destination":"/home","RW":true,"Name":"","Driver":"","Type":"bind","Propagation":"rprivate","Spec":{"Type":"bind","Source":"//docker/","Target":"/home"}}}
3, start-up docker service
systemctl start docker.service
4, start-up docker container
docker start <container-name/ID>
Mode 2 : Commit an existing container as a new mirror , Then run it again
$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5a3422adeead ubuntu:14.04 "/bin/bash" About a minute ago Exited (0) About a
minute ago agitated_newton $ docker commit 5a3422adeead newimagename $ docker
run -ti -v "$PWD/dir1":/dir1 -v "$PWD/dir2":/dir2 newimagename /bin/bash
Then stop the old container , And use this new container , If for some reason you need a new container, use the old name , Please use after deleting the old container docker rename.
Mode 3 :export Container is mirror image , then import New image
$docker container export -o ./myimage.docker container ID $docker import
./myimage.docker newimagename $docker run -ti -v "$PWD/dir1":/dir1 -v
"$PWD/dir2":/dir2 newimagename /bin/bash
Then stop the old container , And use this new container , If for some reason you need a new container, use the old name , Please use after deleting the old container docker rename.

Technology