0% found this document useful (0 votes)
26 views1 page

Docker Cheatsheet

This document is a cheat sheet for using Docker, detailing its capabilities for packaging and running applications in isolated containers. It includes sections on installation, general commands, images, containers, and Docker Hub, providing essential commands for building images, managing containers, and accessing Docker services. The document serves as a quick reference for users to efficiently utilize Docker's features and functionalities.

Uploaded by

workproject497
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

Docker Cheatsheet

This document is a cheat sheet for using Docker, detailing its capabilities for packaging and running applications in isolated containers. It includes sections on installation, general commands, images, containers, and Docker Hub, providing essential commands for building images, managing containers, and accessing Docker services. The document serves as a quick reference for users to efficiently utilize Docker's features and functionalities.

Uploaded by

workproject497
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CLI Cheat Sheet

Docker provides the ability to package and run an application in a loosely isolated environment called a container.
The isolation and security allows you to run many containers simultaneously on a given host. Containers are
lightweight and contain everything needed to run the application, so you do not need to rely on what is currently
installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets
the same container that works in the same way.

INSTALLATION GENERAL COMMANDS


Docker Desktop is available or Mac, Linux and Windows Start the docker daemon
https://docs.docker.com/desktop docker -d

View example projects that use Docker Get help with Docker. Can also use –help on all subcommands
https://github.com/docker/awesome-compose docker --help

Check out our docs for information on using Docker Display system-wide inormation
https://docs.docker.com docker info

IMAGES CONTAINERS
Docker images are a lightweight, standalone, executable package A container is a runtime instance of a docker image. A container
o sofware that includes everything needed to run an application: will always run the same, regardless of the infrastructure.
code, runtime, system tools, system libraries and settings. Containers isolate sofware rom its environment and ensure
that it works uniormly despite dierences or instance between
Build an Image rom a Dockerfle development and staging.
docker build -t <image_name>

Build an Image rom a Dockerfle without the cache Create and run a container rom an image, with a custom name:
docker build -t <image_name> . –no-cache docker run --name <container_name> <image_name>

List local images Run a container with and publish a container’s port(s) to the host.
docker images docker run -p <host_port>:<container_port> <image_name>

Delete an Image Run a container in the background


docker rmi <image_name> docker run -d <image_name>

Remove all unused images Start or stop an existing container:


docker image prune docker start|stop <container_name> (or <container-id>)

Remove a stopped container:


docker rm <container_name>
DOCKER HUB
Open a shell inside a running container:
Docker Hub is a service provided by Docker or nding and sharing docker exec -it <container_name> sh
container images with your team. Learn more and nd images
Fetch and ollow the logs o a container:
at https://hub.docker.com docker logs -f <container_name>

Login into Docker To inspect a running container:


docker login -u <username> docker inspect <container_name> (or <container_id>)

Publish an image to Docker Hub To list currently running containers:


docker push <username>/<image_name> docker ps

Search Hub for an image List all docker containers (running and stopped):
docker search <image_name> docker ps --all

Pull an image from a Docker Hub View resource usage stats


docker pull <image_name> docker container stats

You might also like