docker的端口和目录映射

创建一个docker container,并绑定host目录,同时影射container端口。

$ docker create -it -v ~/projs/astrofate/:/astrofate -p 3000:3000 moicen/ruby bash
771af08a60082073057bfde1af9694fbb777e2fc97003472d8b9cf1bb154edcc
$ docker start 771af08a60082073057bfde1af9694fbb777e2fc97003472d8b9cf1bb154edcc
771af08a60082073057bfde1af9694fbb777e2fc97003472d8b9cf1bb154edcc
$ docker exec -it 771af08a60082073057bfde1af9694fbb777e2fc97003472d8b9cf1bb154edcc  bash
[root@771af08a6008 /]# ls
a.out	   bin	 dev  hello.c  home  lib64  opt   root	sbin  sys  usr
astrofate  boot  etc  hello.s  lib   mnt    proc  run	srv   tmp  var
[root@771af08a6008 /]# ls astrofate/
Gemfile       Rakefile	config	   format.json	package.json	    storage  vendor
Gemfile.lock  app	config.ru  lib		public		    test
README.md     bin	db	   log		sdk_json_format.md  tmp
[root@771af08a6008 /]#

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues