Add start of Docker information

This commit is contained in:
James Skemp 2023-08-01 20:59:32 -05:00
parent 91e17c692f
commit 9be486087a
2 changed files with 48 additions and 0 deletions

View File

@ -14,5 +14,6 @@
- [Angular](./angular.md)
- [.NET](./dotnet.md)
- [Go](./golang.md)
- [Docker](./docker.md)
- [Windows Terminal](./windows-terminal.md)
- [Visual Studio Commands](./visual-studio.md)

47
src/docker.md Normal file
View File

@ -0,0 +1,47 @@
# Docker
> Unless otherwise noted, commands run on Ubuntu 22.
## Setup
```bash
# Add the current user to the docker group so docker can be run without sudo.
sudo usermod -aG docker ${USER}
su - ${USER}
```
## Basics
```bash
# Get installed version.
docker -v
# Verify Docker is setup / run the Hello World image.
sudo docker run hello-world
# Check whether Docker is running.
sudo systemctl status docker
# Search Docker Hub for all images matching a search term (<term>).
docker search <term>
# Show all downloaded images.
docker images
```
## Containers
```bash
# List running containers.
docker ps
# List all containers.
docker ps -a
# Start a container with <container-id> or <container-name>.
docker start <container-id>
docker start <container-name>
# Stop a container with a <container-id> or <container-name>.
docker stop <container-id>
docker stop <container-name>
# Remove a container with a <container-id> or <container-name>.
docker rm <container-id>
docker rm <container-name>
```