Last active
May 17, 2021 03:12
-
-
Save akshay-kakade-dev/feb93b86e92995a60e29afa93ead43df to your computer and use it in GitHub Desktop.
Docker Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .rb extension used only for the coloring purpose. | |
# run docker container from image | |
# if image is not present, it will pull the image and run the container. | |
docker run nginx | |
# show running container | |
docker ps | |
# to stop the docker container | |
docker stop 05e81f235f09(image id or image name) | |
# show all the comtainers (show all the comtainers ) | |
docker ps -a | |
# remove docker container from the container list | |
docker rm 37d7a9e2bca2(image id or image name) | |
# to list all the images | |
docker images list | |
# to remove docker image | |
docker rmi nginx | |
# to remove forcefully | |
docker rmi nginx -f | |
# to pull docker image only | |
docker pull nginx | |
# run command on docker container using exec. | |
docker exec <container-name> cat /home/akshay/development.log | |
# run docker in detach mode | |
docker run -d <image_name> | |
# run docker on custom port | |
docker run -p 80:8080 jenkins/jenkins | |
docker run -p <external_port>:<internal_port> jenkins/jenkins | |
# run docker container in interactive mode and attache psudo terminal | |
docker run -it ubuntu bash | |
# check how much space used by docker. | |
docker system df | |
# list all docker networks | |
docker network ls | |
# copy from host to docker | |
docker cp src_file_name container:/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment