Docker - Setup
Docker#
Update repositories:
| sudo apt update && sudo apt upgrade -y |
|---|
1. Docker Installation:
Step1: Get Docker (-o is used to place the files in a shell file named docker.sh):
| curl -fsSLhttps://get.docker.com-o docker.sh |
|---|
Step2: Install Docker by running the shell command:
| sudo sh docker.sh |
|---|
2. Check if everything is installed correctly:
| docker version |
|---|
| docker compose version |
| docker buildx version |
3. Don’t want to use sudo most of the time for docker commands?
Consider adding the Raspberry Pi User in the Docker Group:
| sudo usermod -aG docker pi |
|---|
4. Check for running docker images:
| docker ps |
|---|
5. Check for all docker images:
| docker ps -a |
|---|
6. Run your first docker image:
| docker run hello-world |
|---|
7. Search for Docker images available on the web:
| docker search image-name |
|---|
8. Start docker containers:
| docker-compose up -d | To run in detached mode - preferred |
|---|---|
| docker-compose up | If you want to run and watch what happens when the container starts |