You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- do not duplicate docker install documentation
- add a note about docker group membership being equivalent to root privileges
- OCI images are now suitable for amd64 and arm/v7 and arm64 architectures
- simplify deleting the shaarli container (since it was started with --rm)
- wording
- use bind mountpoint in /opt/shaarli in examples, no longer use named volumes
- fix WARNING: Non-consecutive header level increase
- preparation for mixed docker/podman setup documentation shaarli#1882
Copy file name to clipboardExpand all lines: doc/md/Docker.md
+48-72Lines changed: 48 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,39 +1,19 @@
1
1
2
2
# Docker
3
3
4
-
[Docker](https://docs.docker.com/get-started/overview/) is an open platform for developing, shipping, and running applications
4
+
[Docker](https://docs.docker.com/get-started/overview/) is an open platform for developing, shipping, and running applications in lightweight containers.
5
5
6
6
## Install Docker
7
7
8
-
Install [Docker](https://docs.docker.com/engine/install/), by following the instructions relevant to your OS / distribution, and start the service. For example on [Debian](https://docs.docker.com/engine/install/debian/):
8
+
Install [Docker](https://docs.docker.com/engine/install/), by following the instructions relevant to your OS / distribution, and start the service.
In order to run Docker commands as a non-root user, you must add the `docker` group to this user:
10
+
_Optional:_ In order to run Docker commands as a non-root user (i.e. without `sudo`), you must add your user account to the `docker` group. Keep in mind that this effectively gives this user account [full root privileges](https://docs.docker.com/engine/security/#docker-daemon-attack-surface), without password.
31
11
32
12
```bash
33
-
#Add docker group as secondary group
13
+
#add your user to the docker group
34
14
sudo usermod -aG docker your-user
35
-
#Reboot or logout
36
-
#Then verify that Docker is properly configured, as "your-user"
15
+
#reboot or logout
16
+
#then verify that Docker is properly configured, as "your-user"
37
17
docker run hello-world
38
18
```
39
19
@@ -48,20 +28,25 @@ Shaarli images are available on [GitHub Container Registry](https://github.com/s
48
28
These images are built automatically on Github Actions and rely on:
49
29
50
30
-[Alpine Linux](https://www.alpinelinux.org/)
51
-
-[PHP7-FPM](https://php-fpm.org/)
31
+
-[PHP-FPM](https://php-fpm.org/)
52
32
-[Nginx](https://nginx.org/)
53
33
34
+
These images are suitable for the `amd64`, `arm/v7` and `arm64` CPU architectures.
35
+
36
+
```{note}
54
37
Additional Dockerfiles are provided for the `arm32v7` platform, relying on [Linuxserver.io Alpine armhf images](https://hub.docker.com/r/lsiobase/alpine.armhf/). These images must be built using [`docker build`](https://docs.docker.com/engine/reference/commandline/build/) on an `arm32v7` machine or using an emulator such as [qemu](https://blog.balena.io/building-arm-containers-on-any-x86-machine-even-dockerhub/).
38
+
```
55
39
56
-
Here is an example of how to run Shaarli latest image using Docker:
40
+
To run the `latest` Shaarli image using Docker:
57
41
58
42
```bash
59
43
# download the 'latest' image from GitHub Container Registry
60
-
docker pull ghcr.io/shaarli/shaarli
44
+
docker pull ghcr.io/shaarli/shaarli:latest
61
45
62
-
# create persistent data volumes/directories on the host
63
-
docker volume create shaarli-data
64
-
docker volume create shaarli-cache
46
+
# create directories for persistent data/cache storage
docker stop myshaarli # stop the running container
85
-
docker ps | grep myshaarli # verify the container is no longer running
86
-
docker ps -a | grep myshaarli # verify the container is stopped
87
-
docker rm myshaarli # destroy the container
88
-
docker ps -a | grep myshaarli # verify th container has been destroyed
69
+
Your Shaarli instance should be available on the host machine at [http://localhost:8000](http://localhost:8000). In order to access your instance through a reverse proxy, we recommend using our [Docker Compose](#docker-compose) build.
89
70
90
-
```
71
+
Stopping the container will also completely remove it (but not persistent volumes) since it was started with `--rm`:
91
72
92
-
After running `docker run` command, your Shaarli instance should be available on the host machine at [localhost:8000](http://localhost:8000). In order to access your instance through a reverse proxy, we recommend using our [Docker Compose](#docker-compose) build.
73
+
```bash
74
+
docker stop myshaarli # stop the running container
75
+
docker ps -a | grep myshaarli # verify the container has been destroyed
76
+
```
93
77
94
78
## Docker Compose
95
79
96
80
A [Compose file](https://docs.docker.com/compose/compose-file/) is a common format for defining and running multi-container Docker applications.
97
81
98
-
A `docker-compose.yml` file can be used to run a persistent/autostarted shaarli service using [Docker Compose](https://docs.docker.com/compose/) or in a [Docker stack](https://docs.docker.com/engine/reference/commandline/stack_deploy/).
99
-
100
-
Shaarli provides configuration file for Docker Compose, that will setup a Shaarli instance, a [Træfik](https://traefik.io/traefik/) instance (reverse proxy) with [Let's Encrypt](https://letsencrypt.org/) certificates, a Docker network, and volumes for Shaarli data and Træfik TLS configuration and certificates.
101
-
102
-
Download docker-compose from the [release page](https://docs.docker.com/compose/install/):
Shaarli provides a `docker-compose.yml` file which can be used to run a persistent/autostarted shaarli service using [Docker Compose](https://docs.docker.com/compose/) or in a [Docker stack](https://docs.docker.com/engine/reference/commandline/stack_deploy/). It sets up a Shaarli instance, a [Træfik](https://traefik.io/traefik/) reverse proxy instance with [Let's Encrypt](https://letsencrypt.org/) certificates, a Docker network, and volumes for Shaarli data and Træfik TLS configuration and certificates.
108
83
109
-
To run Shaarli container and its reverse proxy, you can execute the following commands:
84
+
* Download docker-compose from the [release page](https://docs.docker.com/compose/install/).
85
+
* Run the following commands to start Shaarli and its reverse proxy:
110
86
111
87
```bash
112
-
# create a new directory to store the configuration:
113
-
$ mkdir shaarli &&cd shaarli
114
-
# Download the latest version of Shaarli's docker-compose.yml
88
+
# create a new directory to store your configuration and data
89
+
$ sudo mkdir /opt/shaarli
90
+
$ sudo mkdir /opt/shaarli/data
91
+
$ cd /opt/shaarli
92
+
# download the latest version of Shaarli's docker-compose.yml
$ echo'SHAARLI_DOCKER_TAG=latest'| sudo tee -a .env
100
+
#pull the required images
123
101
$ docker-compose pull
124
-
#Run!
102
+
#run!
125
103
$ docker-compose up -d
126
104
```
127
105
128
-
After a few seconds, you should be able to access your Shaarli instance at [https://shaarli.mydomain.org](https://shaarli.mydomain.org) (replace your own domain name).
106
+
After a few seconds, you should be able to access your Shaarli instance at [https://shaarli.mydomain.org](https://shaarli.mydomain.org).
107
+
129
108
130
109
## Running dockerized Shaarli as a systemd service
131
110
132
-
It is possible to start a dockerized Shaarli instance as a systemd service (systemd is the service management tool on several distributions). After installing Docker, use the following steps to run your shaarli container Shaarli to run on system start.
111
+
It is possible to start a dockerized Shaarli instance as a systemd service (systemd is the service management tool on several distributions), that will start automatically on system boot:
133
112
134
113
As root, create `/etc/systemd/system/docker.shaarli.service`:
Token expiration: To avoid infinite token validity, JWT tokens must include their creation date in UNIX timestamp format (timezone independent - UTC) under the key `iat` (issued at) field ([1](https://datatracker.ietf.org/doc/html/rfc7519)). This token will be valid during **9 minutes**.
103
103
@@ -107,7 +107,7 @@ Token expiration: To avoid infinite token validity, JWT tokens must include thei
107
107
}
108
108
```
109
109
110
-
#####Signature
110
+
#### Signature
111
111
112
112
The signature authenticates the token validity. It contains the base64 of the header and the body, separated by a dot `.`, hashed in SHA512 with the API secret available in Shaarli administration page.
0 commit comments