aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Dockerfile1
-rw-r--r--doc/md/docker/shaarli-images.md35
2 files changed, 30 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index 8e0a5621..6261e81b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -62,6 +62,7 @@ RUN chown -R nginx:nginx . \
62 && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ 62 && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \
63 && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log 63 && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log
64 64
65VOLUME /var/www/shaarli/cache
65VOLUME /var/www/shaarli/data 66VOLUME /var/www/shaarli/data
66 67
67EXPOSE 80 68EXPOSE 80
diff --git a/doc/md/docker/shaarli-images.md b/doc/md/docker/shaarli-images.md
index e6fbff64..5948949a 100644
--- a/doc/md/docker/shaarli-images.md
+++ b/doc/md/docker/shaarli-images.md
@@ -32,9 +32,10 @@ build`](https://docs.docker.com/engine/reference/commandline/build/) on an
32`arm32v7` machine or using an emulator such as 32`arm32v7` machine or using an emulator such as
33[qemu](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/). 33[qemu](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/).
34 34
35### Download from DockerHub 35### Download from Docker Hub
36```bash 36```shell
37$ docker pull shaarli/shaarli 37$ docker pull shaarli/shaarli
38
38latest: Pulling from shaarli/shaarli 39latest: Pulling from shaarli/shaarli
3932716d9fcddb: Pull complete 4032716d9fcddb: Pull complete
4084899d045435: Pull complete 4184899d045435: Pull complete
@@ -52,7 +53,7 @@ Status: Downloaded newer image for shaarli/shaarli:latest
52``` 53```
53 54
54### Create and start a new container from the image 55### Create and start a new container from the image
55```bash 56```shell
56# map the host's :8000 port to the container's :80 port 57# map the host's :8000 port to the container's :80 port
57$ docker create -p 8000:80 shaarli/shaarli 58$ docker create -p 8000:80 shaarli/shaarli
58d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 59d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101
@@ -68,7 +69,7 @@ d40b7af693d6 shaarli/shaarli /usr/bin/supervisor 15 seconds ago Up 4 seconds
68``` 69```
69 70
70### Stop and destroy a container 71### Stop and destroy a container
71```bash 72```shell
72$ docker stop backstabbing_galileo # those docker guys are really rude to physicists! 73$ docker stop backstabbing_galileo # those docker guys are really rude to physicists!
73backstabbing_galileo 74backstabbing_galileo
74 75
@@ -90,12 +91,34 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
90``` 91```
91 92
92### Automatic builds 93### Automatic builds
94Docker users can start a personal instance from an
95[autobuild image](https://hub.docker.com/r/shaarli/shaarli/).
96For example to start a temporary Shaarli at ``localhost:8000``, and keep session
97data (config, storage):
93 98
94Docker users can start a personal instance from an [autobuild image](https://hub.docker.com/r/shaarli/shaarli/). For example to start a temporary Shaarli at ``localhost:8000``, and keep session data (config, storage): 99```shell
95```
96MY_SHAARLI_VOLUME=$(cd /path/to/shaarli/data/ && pwd -P) 100MY_SHAARLI_VOLUME=$(cd /path/to/shaarli/data/ && pwd -P)
97docker run -ti --rm \ 101docker run -ti --rm \
98 -p 8000:80 \ 102 -p 8000:80 \
99 -v $MY_SHAARLI_VOLUME:/var/www/shaarli/data \ 103 -v $MY_SHAARLI_VOLUME:/var/www/shaarli/data \
100 shaarli/shaarli 104 shaarli/shaarli
101``` 105```
106
107### Volumes and data persistence
108Data can be persisted by [using volumes](https://docs.docker.com/storage/volumes/).
109Volumes allow to keep your data when renewing and/or updating container images:
110
111```shell
112# Create data volumes
113$ docker volume create shaarli-data
114$ docker volume create shaarli-cache
115
116# Create and start a Shaarli container using these volumes to persist data
117$ docker create \
118 --name shaarli \
119 -v shaarli-cache:/var/www/shaarli/cache \
120 -v shaarli-data:/var/www/shaarli/data \
121 -p 8000:80 \
122 shaarli/shaarli:master
123$ docker start shaarli
124```