Skip to content

Instantly share code, notes, and snippets.

@Neeraj1005
Neeraj1005 / docker-cmd.md
Created January 8, 2024 11:46
Docker commands

Docker Commands

  • Run Docker Image: docker run -it your-image-name
  • Or, if you want to run a specific command within the image, like running a bash shell: docker run -it your-image-name /bin/bash
  • Create Docker Image: docker build -t your-project-name . The dot at the end indicates that the build should occur in the root directory. If you want to build from a different directory, use the ../ syntax.
  • List Docker Images: docker images
  • Remove Docker Image: docker image rm image-name
  • Forcefully Remove Docker Image: docker image rm image-name -f
  • List Containers: docker ps -a
  • Remove Container: docker container rm container_name