Paul Sutton writes:
On 27/03/2019 12:59, Luís Gomes wrote: > Hello everyone, > > I'm setting up a server with Debian Stretch and I need to install > Docker.
[...] Hello,for my Debian installations, I have basically followed the recommendations from the official Docker website:
https://docs.docker.com/install/linux/docker-ce/debian/It describes multiple installation methods and I chose the one based on adding a repository.
[...]
using instructions from herehttps://www.itzgeek.com/how-tos/linux/debian/how-to-install-docker-on- debian-9.html
This guide is good except for the last point``Allow non-root user to run Docker''. Think twice before doing that because Docker access is essentially equal to being root (try `docker run --rm -it -v /:/mnt debian:9 /bin/bash` if you do not believe it*** :) ).
However I did find that containers are stored in /var/lib/docker which caused a problem for me, as my / partition was small (about 30gb),
This is good to know in advance, yes!While one is at ensuring enough storage is available, it also makes sense to check that Docker runs with backend overlay2. To do this, check `docker info`
output. A change of storage backend can be achieved by passing`--storage-driver=overlay2` to the daemon or by creating a suitable json configuration file.
It is recommendable to do this before even running the hello-world example (probably even before starting the Docker daemon for the first time, but then `docker info` is not available), because it will cause Docker to no longer be able to read containers and images from before switching the storage backend.
[...]
I also found that restarting docker, also creates a new container each time, problem as at the time I was testing next cloud, etc
Interesting. For me, it only stops all the containers without proper`--restart` parameter. I have never seen a docker upgrade create additional containers. Did you possibly run `docker run` again because that would always create a new container?
I then found by using docker run -d --restart="always" -p 8080:80 nextcloud it started the same instance and the same container, Before (I was'nt starting with '--restart="always"' and I ended up with several containers, each time I restarted docker, so my previous container + user account were still there, just not loaded.
[...]Please note that the recommended Docker way of dealing with this issue is to put data in a separate volume (or my preference: store it locally on the machine in a file-system location) like this (create `/srv/nextcloud` or any other suitable path first):
docker run -d --restart=always -p 8080:80 -v /srv/nextcloud:/var/www/html nextcloudThis way, you can update your container by issuing `docker pull nextcloud` and then stopping the container and re-running the command. If everything is OK, the update worked and the old container can be deleted which will usually cause the space of the old image to be freed as well... if not: restart the old container and hope the DB schema did not change (not sure how/if nextcloud handles/needs this...).
It might also be advisable to not take the `:latest` tag but rather a specific version like nextcloud:15-fpm or such. This way, new releases will not come by surprise when doing `docker pull nextcloud:15-fpm` but only after consciously deciding for a new release.
This mail is not strictly all on the topic of installing Docker but I hope this post is still useful for everyone getting started with it :)
***) `--rm` does not mean: Delete my data here (it just deletes the container after exit), but in case of doubt one may as well try the command without the `--rm` :)
HTHLinux-Fan
Attachment:
pgpxZtbzuM3aB.pgp
Description: PGP signature