mirror of
https://github.com/tborychowski/self-hosted-cookbook.git
synced 2025-01-22 19:38:30 +00:00
update docker installation docs
This commit is contained in:
parent
0439636c54
commit
a2a8f2cb25
@ -8,35 +8,25 @@ Installation instructions for Ubuntu Linux from: https://docs.docker.com/engine/
|
|||||||
sudo apt-get remove docker docker-engine docker.io containerd runc
|
sudo apt-get remove docker docker-engine docker.io containerd runc
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install Docker
|
## Install Docker & docker-compose-plugin (on Ubuntu)
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get update
|
sudo apt update
|
||||||
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
|
sudo apt install ca-certificates curl gnupg lsb-release
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install docker-ce docker-ce-cli containerd.io
|
|
||||||
```
|
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
## Install `docker-compose`
|
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||||
From: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo apt-get remove docker-compose
|
|
||||||
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
||||||
sudo chmod +x /usr/local/bin/docker-compose
|
|
||||||
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Full docs are here: https://docs.docker.com/compose/reference/overview/
|
Full docs are here: https://docs.docker.com/compose/reference/overview/
|
||||||
|
|
||||||
Generally the idea of `docker-compose` command is simple:
|
Generally the idea of `docker compose` command is simple:
|
||||||
1. First you create a folder for your service, e.g. `home-assistant`
|
1. First you create a folder for your service, e.g. `home-assistant`
|
||||||
2. Then you then create a `docker-compose.yml` file, which describes the service containers
|
2. Then you then create a `docker-compose.yml` file, which describes the service containers
|
||||||
3. You run `docker-compose up -d` and you're done!
|
3. You run `docker compose up -d` and you're done!
|
||||||
|
|
||||||
Here are the most frequently used commands:
|
Here are the most frequently used commands:
|
||||||
|
|
||||||
@ -44,20 +34,20 @@ Here are the most frequently used commands:
|
|||||||
#### Start a container
|
#### Start a container
|
||||||
`-d` starts in a detached mode - which basically mean that it runs it in the background (so you can do other stuff, instead of looking at the logs).
|
`-d` starts in a detached mode - which basically mean that it runs it in the background (so you can do other stuff, instead of looking at the logs).
|
||||||
```sh
|
```sh
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
### Stop a container
|
### Stop a container
|
||||||
There are 2 options:
|
There are 2 options:
|
||||||
```sh
|
```sh
|
||||||
docker-compose stop
|
docker compose stop
|
||||||
docker-compose down
|
docker compose down
|
||||||
```
|
```
|
||||||
First one (`stop`) onlu stops the containers, whereas the latter (`down`) does some more cleaning (removes the containers, networks, volumes), so I generally recommend `down` if you're tinkering.
|
First one (`stop`) onlu stops the containers, whereas the latter (`down`) does some more cleaning (removes the containers, networks, volumes), so I generally recommend `down` if you're tinkering.
|
||||||
|
|
||||||
|
|
||||||
### Update a container to use the latest published image
|
### Update a container to use the latest published image
|
||||||
```sh
|
```sh
|
||||||
docker-compose pull && docker-compose up -d
|
docker compose pull && docker compose up -d
|
||||||
```
|
```
|
||||||
This pulls the latest images as defined in the local `docker-compose.yml` and recreates the containers.
|
This pulls the latest images as defined in the local `docker-compose.yml` and recreates the containers.
|
||||||
|
Loading…
Reference in New Issue
Block a user