--detach , -d Run container in background and print container ID
--name Assign a name to the container
--publish , -p Publish a container’s port(s) to the host
--volume , -v Bind mount a volume
--restart Restart policy to apply when a container exits
$ docker images
REPOSITORY TAG IMAGE ID CREATED
jamesmedice/marketplace latest e78c49b5f380 2 days ago
jamesmedice/marketplace v1.0.0 *e78c49b5f380* 2 days ago
$ docker run -p 6001:8585 *e78c49b5f380*
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
apache_snapshot latest 13037686eac3 22 seconds ago 249MB
ubuntu latest 00fd29ccc6f1 3 weeks ago 111MB
现在你可以在交互模式下将Docker镜像作为容器运行:
$ docker run -it apache_snapshot /bin/bash
或者,如果您在本地没有任何图像,请在Docker Hub中搜索要下载的图像:
$ docker search ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian... 6759 [OK]
dorowu/ubuntu-desktop-lxde-vnc Ubuntu with openss... 141 [OK]
rastasheep/ubuntu-sshd Dockerized SSH ser... 114 [OK]
ansible/ubuntu14.04-ansible Ubuntu 14.04 LTS w... 88 [OK]
ubuntu-upstart Upstart is an even... 80 [OK]