0% found this document useful (0 votes)
10 views

docker commands

Uploaded by

r19512695
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

docker commands

Uploaded by

r19512695
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. docker images ----------To see the images of the files.

2. docker create (image id) ---------- it will create a container for that image.
3. docker ps -a -------------- it will show the created containers.
4. docker start ( container id) ------------- it will start the container.
5. docker ps ----------- it will show the running containers.
6. docker exec -it ( container id) /bin/bash -------------------- we can login into
that container.
7. ls ------------ it will show the files in that container.
8. ls -ltr ---------------- it will show the the permissions of the container.
9. touch (filename and format)---------- To create a file.
10. docker --version ------------------ it will show the docker version.
11. docker login ----------------------it will help to login to docker hub.
12. docker logout --------------------- you can logout.
13. docker serach (what do you want ) --------------------- we can search images by
command line.
14. docker pull (image name) ---------------- you can download that image in
docker.
15. docker inspect image (image name) ------------- It will show the extra
information of the image.
16. docker image ls ------------ it will show the list of images that you can
downloaded in local.
17. docker create ( image name) ---------------- it will create a containerfor that
iage.
18. docker stop ( container name or id)----------------- it will stop the
container.
19. docker create --name (custom name) (image name) -------------------- we can
create a custom name for the container.
20. docker rm ----------- to delete the container.
21. docker run --name ( custom name ) ( image name) ------------------- it will
create a container and start the container and leave at the starting stage you can
login into the container.To exit ctrl+z,ctrl+c sometime you can't exit.You have to
stop the container in new terminal.
22. docker run -d --name (custom name) ( image name) ------------------it will do
same as above but it will login but it will logout and come out.
23. docker kill (container name) ------------------ if the container is
unresponsive it will forcefull shutdown the container.
24. docker rmi (image id) ----------------------- it will remove the image after
stoping the container.
25. docker network ls --------------------------- to see the network indocker.
26. Three types:-bridge ,host ,none:-default-bridge network.
27. docker run -d --name (custom name) -p 8080:80 (image name)
------------------------- we can access via web using docker host ip address
(192.168.1.1:8080) it works.
28. docker run -d --name (custom name) -p 8081:80 (image name)-------------- same
as above command,same ip address with different ports this is bridge concept.
29. docker network ls------------------ it will show the the networks namess.
30. As per bridge it will give assign different ip address for the image to
communicate.For bridge.
31. docker run -d --name (custom name) --net host (image name)----------we can
access directly without ports. we can't run multiple containers with same ip that
is host networking.
32. docker run -d --name (custom name) --net none (image name)---------- it can't
communicate in externally in internally.

----------------------------------Docker
File-------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---

1.

You might also like