zane@zane-V:~$ docker run -d -P --name web -v /webapp training/webapp python app.py8a1626618e6ad963e18021a42847034196686745b202395d0412e35beb85976d
$ docker inspect web..... "Mounts": [ { "Name": "c72823cb4542875fdb1103362dc3b743c87057bfdfe29a7cf66af65f73d16d07", "Source": "/var/lib/docker/volumes/c72823cb4542875fdb1103362dc3b743c87057bfdfe29a7cf66af65f73d16d07/_data", "Destination": "/webapp", "Driver": "local", "Mode": "", "RW": true, "Propagation": "" } ],.....
zane@zane-V:~$ docker run -d -P --name webb -v /src/webapp:/webapp training/webapp python app.py3b34d9907b5bae0e5e038b11b6e1f62e6579df5d11aeb850df7907f309f0c060
$ docker run -d -P --name web -v /src/webapp:/webapp:ro training/webapp python app.py
zane@zane-V:~$ docker run -d -P --volume-driver=local -v my-named-volume:/webapp --name weeb training/webapp python app.py99736975af3d8c2f6224b957ac24ef6ff4a833cb6bd56b64678858c01ba2463a
$ docker volume create -d flocker --opt o=size=20GB my-named-volume$ docker run -d -P \ -v my-named-volume:/webapp \ --name web training/webapp python app.py
$ docker run --rm -it -v ~/.bash_history:/root/.bash_history ubuntu /bin/bash
zane@zane-V:~$ docker create -v /dbdata --name dbstore training/postgres /bin/true603ccc61bb00ef29943a76ce3bc8da7694482f49f0a62a282743a39aa81e592a
zane@zane-V:~$ docker run -d --volumes-from dbstore --name db1 training/postgres1532719b9bc2bb0a2b0570077e7e8d03cdd6feddb84d406901548163fe15a953 zane@zane-V:~$ docker run -d --volumes-from dbstore --name db2 training/postgres1ca6bbde65d12f7bbb40ad0854bff346bfad56e374775d08f8583c9913c9240e
zane@zane-V:~$ docker run -d --name db3 --volumes-from db1 training/postgres5a1bebcc03c4c945197eb717f4e7575cd0ad4fefdb33df1c4d033dacf8517d56
$ docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu && tar cvf /backup/backup.tar /dbdata
$ docker run -v /dbdata --name dbstore2 ubuntu /bin/bash Then un-tar the backup file in the new container`s data volume. $ docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu bash -c "cd /dbdata && tar xvf /backup/backup.tar --strip 1" You can use the techniques above to automate backup, migration and restore testing using your preferred tools.
联系客服