首页 > 代码库 > [Docker] Run, Stop and Remove Docker Containers
[Docker] Run, Stop and Remove Docker Containers
In this lesson, we‘ll find out the basics of running Docker containers. We‘ll go over how to download images from Docker Hub, what happens when you stop containers, how to restart a container once it‘s been stopped, and also how to remove containers.
Run a container:
docker run mongo // run the container, if container not exists, download from hub
This will output the console log in the command line
Another way to run docker is in the backage:
docker run -d mongo
To stop a container running:
docker stop <container id>
To varify there is not container running:
docker ps
List all the container regarelss running or not:
docker ps -a
Start an container:
docker start <container_id>
Remove an container:
docker rm <container_id>
Notice that container shoud be stop first, then you can remove it.
[Docker] Run, Stop and Remove Docker Containers
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。