Master the 8 essential Docker commands that every software developer should know to build, run, and manage containers efficiently. Boost your productivity and build better software with Docker.
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Well that all developer is aware of.
Here I have listed some basic docker commands that every software developer should be familiar with.
Note: This list will enrich as days go on. Feel free to write comment is anything missed.
docker ps
# your can add available [OPTIONS] belowdocker ps -aq
# only shows IDs
[OPTIONS]
few are .. More you can find from here
--all
# or -a Show all containers (default shows just running)--filter
# or -f Filter output based on conditions provided--format
# Pretty -print containers using a Go template
docker stop CONTAINER_ID
# copy container id from docker psdocker stop $(docker ps -aq)
# stop all Running containers
docker rm CONTAINER_ID
# Delete Specific containerdocker rm $(docker ps -aq)
# Remove all container
docker image ls
# List all available images in your machine.docker image ls -aq
# list image ids only
docker image rm IMAGE_ID
# Remove specific image docker image rm -f IMAGE_ID
# force remove including dependent child images
docker image build -t IMAGE_NAME:BUILD_NUMBER .
# build image based on docker file in Current directory (.)
# Command format -> docker run [OPTIONS] IMAGE [COMMAND] [ARG...] docker run -d --name YourContainerName -p x:y \ # -d will Run container in background and print container ID
# Docker run on image in port x
# EXPOSE Y from Docker file-e REACT_APP_SOME_ENVIRONMENT = someEnv \
# Set some environment variableIMAGE_NAME:BUILD_NUMBER
# Your image with build number
docker exec -it CONTAINER_NAME sh
# Now you can enter command in the containerExit
# For getting Out from the docker Container
#docker