Created
September 29, 2024 10:26
-
-
Save omernaci/7cd96de42a36d6bf202ac647e797c331 to your computer and use it in GitHub Desktop.
Docker Containers Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command | Description | |
---|---|---|
docker ps | Lists all running containers. | |
docker ps -a | Lists all containers (including stopped ones). | |
docker run <image-name> | Creates and starts a new container from the specified image. | |
docker run -d <image-name> | Runs a container in detached mode (in the background). | |
docker run -it <image-name> | Runs a container interactively (for terminal access). | |
docker stop <container-id> | Stops a running container. | |
docker start <container-id> | Starts a stopped container. | |
docker restart <container-id> | Restarts a container. | |
docker rm <container-id> | Removes a stopped container. | |
docker exec -it <container-id> <command> | Runs a command inside a running container (with terminal access). | |
docker logs <container-id> | Shows the logs of a running or stopped container. | |
docker inspect <container-id> | Shows detailed information about the container. | |
docker cp <source> <destination> | Copies files between the host and a container. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment