Wednesday, 10 July 2019

10 Docker Command Part-2 By Raj Gupta



1. To remove the stop container

[root@ip-172-31-92-105 ~]# docker container rm 4a79e7c7d036

2. To remove the multiple stop container

[root@ip-172-31-92-105 ~]# docker container rm afcd9e49df33 84d890f1eba0

3. To start the stop container

[root@ip-172-31-38-174 ~]# docker container start 2b4ed9cb2cbd

4. To stop the running container

[root@ip-172-31-38-174 ~]# docker container stop 2b4ed9cb2cbd

5. To run the container in the background

[root@ip-172-31-38-174 ~]# docker container run -d ubuntu sleep 30

6. To go inside the container

[root@ip-172-31-38-174 ~]# docker container run -it ubuntu /bin/bash

7. To come out of container but it will also stop the running container

root@eb1bd5486f0f:/# exit  or ctrl+d

8. By use of this you will come out of container but your container will run in background

Ctrl+pq

9. This will give container id of all running and stop container

[root@ip-172-31-38-174 ~]# docker container ls –aq

10. This will delete all the container at the same time

root@ip-172-31-38-174 ~]# docker container rm $(docker container ls -aq)

No comments:

Post a Comment