https://github.com/th-blitz/docker-commands
docker commands
https://github.com/th-blitz/docker-commands
Last synced: about 1 month ago
JSON representation
docker commands
- Host: GitHub
- URL: https://github.com/th-blitz/docker-commands
- Owner: th-blitz
- License: mit
- Created: 2022-06-10T08:50:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-14T15:51:52.000Z (over 3 years ago)
- Last Synced: 2025-02-21T15:37:52.414Z (8 months ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-commands
- pull a docker image from docker hub.docker pull {image_name}
- list all docker images.
docker image ls- run a docker container.
docker run {image_name}
here the image runs and gets terminated.
docker run -d -t {image_name}
docker run -d -t --name={container_name} {image_name}
docker run --rm -d -t --name={container_name} {image_name}
docker run --rm -d -t --name={container_name} -p {local_host_port eg:8888}:{container_port eg:8888} {image_name}
docker run --rm -d -t --name={container_name} -p 8888:8888 --mount src="$(pwd)",target=/app,type=bind {image_name}here the image is running in the background.
- list all running docker containers.
docker ps -a
docker ps- To access the running container.
docker exec -ti {container_name OR container_id} bash
- To stop the container.docker stop {container_name OR container_id}
- To delete the container.docker rm {container_name OR container_id}
- To save the changes of container.docker commit {container_name OR container_id} {new_image_name}
- To run jupyter in a container.
jupyter notebook --ip='0.0.0.0' --port=8888 --no-browser --allow-root
- Remove all stopped containers.
docker container prune
- Check docker build cache.docker system df
- Get IDs of all running containers.
docker ps -q
- Stop All running containers.docker stop $(docker ps -q)
{replace docker stop with docker kill to foricble kill all running containers}
- Delete all dangling images.docker image prune
- Remove all docker volumes.docker volume prune
- Remove all docker network.docker network prune
- Remove everything !!docker system prune
-