Skip to content

Latest commit

 

History

History
64 lines (53 loc) · 1.1 KB

docker-commands.md

File metadata and controls

64 lines (53 loc) · 1.1 KB

Commands

  • Building the image

    docker build -t <image-name> .
    
  • Run the docker image

    docker run -d -p <port-num>:<port-num> <image-id>
    
  • To see the list of docker image

    docker image ls
    
  • List of Containers

    docker ps
    
  • Find running containers

    docker container ls
    
  • Stop the container

    docker container stop <container-id>
    
  • Push the Image to the DockerHub.

    docker push <DockerHub-Username>/<repo-name>:<TAG-of-image>
    
    • Remove an Docker Image
      docker rmi <id>
      docker rmi <repository> : <tag>
           
      docker rmi -f <id>
      
  • Display logs of a container

    docker logs <container-name>
    
  • Scan docker image

    docker scan <image-name>
    
  • Kill a Container

    docker kill <container-name>
    
  • Free disk taken by Docker images, volume etc.

    docker system prune --all
    
  • Useful Links https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes