Docker Hub Registry
sudo docker login
- To login into default docker registry https://hub.docker.com/sudo docker login registryURL
- To login into private registrysudo docker push repoName/imageName:tag
- Push image to registry in given repoName=respository name, as imageName with tag=ex. 1.0.0sudo docker pull repoName/imageName:tag
- Pulgl docker imagesudo docker tag existingRepoName/imageName:tag newRepoName/imageName:tag
- Create new tagged image
Interacting with Container
sudo docker run -it imageName
– -i means interactive, -t means provide terminalsudo docker run -d imageName
- -d means run in background modesudo docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
sudo docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
- copy from host to container, viceversa possiblesudo docker exec containerName/ID command
- run a command in existing container, giving output on localhost terminalsudo docker exec -it containerName/ID /bin/bash
- use to go inside containersudo docker ps
– list running containerssudo docker ps -a
– list all containerssudo docker start containerName/ID
– start the stopped containersudo docker stop containerName/ID
– stop the running containersudo docker rm containerName/ID
– remove the container processsudo docker rm $(sudo docker ps -aq)
– remove all exited container processsudo docker inspect containerName/ID
– show information about container in json formatsudo docker logs containerName/ID
– Fetch the logs from container, argument -f will show live logssudo docker stats containerName/ID
– show live usage of resources by container (can be run with multiple container in the same command line)sudo docker top containerName/ID
– show running process in container
Docker Image Management Commands
sudo docker build -t repoName/imageName .
– Create docker imagesudo docker images
– list the imagesudo docker history imageName
– show the image historysudo docker inspect imageName
– show docker image information in json formatsudo docker tag imageName1 imageName2
– tag the imagesudo docker rmi imageName
– remove the imagesudo docker pull repoName/imageName
– pull the docker image from registrysudo docker push repoName/imagename
– push the docker image to registrysudo docker save imageName -o imageName.tar.gz
– save the image as tar ballsudo docker load --input tarFileName.tar.gz
– load the image from tar ball as docker image
Other Commands
sudo docker info
– display the system-wide information about docker
Comments
Post a Comment