This content originally appeared on DEV Community and was authored by Rohith V
Commands to remember :
docker run
:- runs a command in a new container .docker run = docker create + docker start
docker run -p <localhostport>:<containerport> <imagename/id>
:- running on portsdocker ps
:- to list all the running containersdocker ps --all
:- list all the container ever createddocker system prune
:- to delete all the containers ever created along with some other propertiesdocker logs <container-id>
:- to get the logsdocker start
:- start stopped containerdocker stop
:- stop the container - gets a sigterm message - terminate signaldocker kill
:- kills the container or stops the container instantlydocker exec -it <container id> <command>
:- Execute an additional command in container.-it
makes us to provide the input.-it equivalent to -i -t
docker exec -it <container id> sh
:- provides access to the terminal inside the context of the containerdocker build .
:- build an image from a Docker filedocker-compose up
:- aggregates the output of each container. Similar to docker run myimagedocker-compose up --build
:- similar to docker build and docker run. Rebuilds the container after making any changes to the filedocker-compose up -d
:- starts the containers in the background and leaves them runningdocker-compose down
:- stops the running containers at the same timedocker-compose ps
:- show the status of the containersdocker commit
:- manual image generationdocker build -f <filename> .
:- to run a dockerfile with some different namedocker pull
:- pulls an image from registrydocker push
:- pushes an image to registrydocker search
:- search for an image in Docker Hubdocker history
:- shows the history of the imagedocker info
:- shows system wide informationdocker rm
:- remove one or more containersdocker rmi
:-remove one or more imagesdocker pause
:- pauses all processes within one or more containersdocker unpause
:- unpause all processes within one or more containers
Rohithv07 / Docker
My Workplay on Docker and Kubernetes. Ref : https://github.com/Rohithv07/DockerCasts
Docker and Kubernetes
My Workplay on docker
Commands to remember :
-
docker run
:- runs a command in a new container .docker run = docker create + docker start
-
docker run -p <localhostport>:<containerport> <imagename/id>
:- running on ports -
docker ps
:- to list all the running containers -
docker ps --all
:- list all the container ever created -
docker system prune
:- to delete all the containers ever created along with some other properties -
docker logs <container-id>
:- to get the logs -
docker start
:- start stopped container -
docker stop
:- stop the container - gets a sigterm message - terminate signal -
docker kill
:- kills the container or stops the container instantly -
docker exec -it <container id> <command>
:- Execute an additional command in container.-it
makes us to provide the input.-it equivalent to -i -t
-
docker exec -it <container id> sh
:- provides access to the terminal…
This content originally appeared on DEV Community and was authored by Rohith V
Rohith V | Sciencx (2021-08-05T09:00:22+00:00) Important Docker Commands To Know As A Beginner. Retrieved from https://www.scien.cx/2021/08/05/important-docker-commands-to-know-as-a-beginner/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.