官术网_书友最值得收藏!

  • Containers in OpenStack
  • Pradeep Kumar Singh Madhuri Kumari
  • 141字
  • 2021-07-02 21:17:25

Creating containers

Launching a container is simple, as docker run passes the image name you would like to run and the command to run this within the container. If the image doesn't exist on your local machine, Docker will attempt to fetch it from the public image registry:

$ sudo docker run --name hello_world ubuntu /bin/echo hello world  

In the preceding example, the container will start, print hello world, and then stop. Containers are designed to stop once the command executed within them has exited.

As an example, let's run a container using the latest image in Ubuntu. The combination of the -i and -t switches gives you interactive shell access to the container:

$ sudo docker run -it ubuntu
root@a5b3bce6ed1b:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  
run sbin srv sys tmp usr var
主站蜘蛛池模板: 钦州市| 洛扎县| 长治市| 弋阳县| 景谷| 高雄县| 宣武区| 化州市| 上思县| 洛南县| 南阳市| 黄陵县| 长泰县| 鸡泽县| 龙岩市| 奈曼旗| 凌云县| 西安市| 科尔| 海盐县| 新巴尔虎右旗| 洞头县| 团风县| 淮滨县| 霸州市| 铜山县| 东莞市| 获嘉县| 彝良县| 泽库县| 沭阳县| 靖西县| 赤峰市| 比如县| 佛教| 钦州市| 铜鼓县| 泰和县| 墨江| 文安县| 普格县|