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

  • 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
主站蜘蛛池模板: 安吉县| 平江县| 云霄县| 玛多县| 清远市| 漯河市| 高邮市| 石楼县| 沾益县| 福贡县| 商水县| 奉化市| 奇台县| 绥化市| 延寿县| 楚雄市| 卢湾区| 昭平县| 呼图壁县| 红安县| 银川市| 齐齐哈尔市| 定结县| 平罗县| 巴林左旗| 南召县| 阜平县| 汤阴县| 台江县| 阿拉善盟| 饶阳县| 闽侯县| 巨野县| 苍山县| 奉节县| 莎车县| 克拉玛依市| 徐州市| 昆山市| 霍林郭勒市| 花莲县|