Build Image
DevOps Docker Build Image
command | description |
---|---|
docker login | Login to docker hub |
docker push | Push the image to docker hub |
docker pull {IMAGE_NAME} |
Pull the image from docker hub |
docker run {IMAGE_NAME} |
Run containers |
docker run -d {IMAGE_NAME} |
Run containers on detached mode (Background) |
docker image inspect {IMAGE_NAME} |
Get image info |
docker exec -ti {CONTAINER_NAME} bash |
Go into the current running container and using the bash |
docker start {CONTAINER_NAME} |
Start stopped containers |
docker stop {CONTAINER_NAME} |
Stop containers |
docker kill {CONTAINER_NAME} |
Kill containers |
docker top {CONTAINER_NAME} |
Check the current container process |
docker ps | List running containers |
docker ps -a | List running and stopped containers |
docker info | Display system information |
docker images | Lists images |
docker version | Display the system’s version |
options | description |
---|---|
-d | Detach the container to the background |
-i | Allow interactive with the container |
-t | Allow using tty with the container |
-p | expose socker from ouside port:inside port (e.g. 8080:80) |
–restart | Always restart the container if it runs fail |
–rm | Remove the container while the container finish its job |
command | description |
---|---|
docker run –memory=“256m” nginx | Max Memory |
docker run –cpus=".5" nginx | Max CPU |
command | description |
---|---|
docker run –it nginx – /bin/bash | Attach shell |
docker run –it – microsoft/powershell:nanoserverpwsh.exe | Attach Powershell |
docker container exec –it {CONTAINER_NAME} –bash |
Attach to running container |
command | description |
---|---|
docker rm {CONTAINER_NAME} |
Remove stopped containers |
docker rm $(docker ps -a -q) | Remove all stopped containers |
docker rmi {IMAGE_NAME} |
Delete the image |
docker system prune -a | Removes all images not in use by any containers |
DevOps Docker Build Image
DevOps Docker Images
DevOps Docker Container
DevOps Docker Volume
DevOps Docker Log
DevOps Docker Compose
DevOps Docker Network
DevOps Docker Scheduling
DevOps Docker Monitor
DevOps Docker Use case