Skip to content

Instantly share code, notes, and snippets.

@Sunny-unik
Last active December 12, 2023 16:03
Show Gist options
  • Save Sunny-unik/505ffe8fd375c08dda55f1b4fe120f10 to your computer and use it in GitHub Desktop.
Save Sunny-unik/505ffe8fd375c08dda55f1b4fe120f10 to your computer and use it in GitHub Desktop.
Docker basic commands
docker run -it <image-name> # for run new image (if not present locally then docker install it from 'hub.docker.com')
docker run -it -p system-port:docker-port <service-name> # port mapping
docker run -it -p system-port:docker-port -e key='value' -e key='value' <service-name> # port mapping with setting env
docker exec <container-name> <command> # for execute a command inside specified container
docker pull <image-name> # for pull docker image using image-names
docker images # shows all installed images
docker login -u <dockerhub-username> # for login with username
docker ps # for list all running docker container
docker ps -a # for list all docker container
docker stop <container-id> # for stop specified container
docker network ls # list all networks
docker network inspect bridge # display detailed information about the bridge network
docker system prune -a # shows a prompt for remove images, containers, networks & cache those are not in use
docker build -t <image-name followed by ':<tagname>'> # build an image
docker push <image-name followed by ':<tagname>'> # push an image to docker hub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment