mathz.nu Asterisk Blacklist Hobby webbhotell

2019/02/15

How to move docker’s default /var/lib/docker to another directory on Ubuntu/Debian Linux

Filed under: Docker,Server — Mathz @ 11:00

The following config will guide you through a process of changing the docker’s default /var/lib/docker storage disk space to another directory. There are various reasons why you may want to change docker’s default directory from which the most obvious could be that ran out of disk space. The following guide should work for both Ubuntu and Debian Linux or any other systemd system. Make sure to follow this guide in the exact order of execution.

Let’s get started by modifying systemd’s docker start up script. Open file /lib/systemd/system/docker.service with your favorite text editor and replace the following line where /new/path/docker is a location of your new chosen docker directory:

FROM:
ExecStart=/usr/bin/docker daemon -H fd://
TO:
ExecStart=/usr/bin/docker daemon -g /new/path/docker -H fd://

When ready stop docker service:

# systemctl stop docker

It is important here that you have completely stopped docker daemon. The following linux commandwill yield no output only if docker service is stopped:

# ps aux | grep -i docker | grep -v grep

If no output has been produced by the above command, reload systemd daemon:

# systemctl daemon-reload

Once this is done create a new directory you specified above and optionally rsync current docker data to a new directory:

# mkdir /new/path/docker
# rsync -aqxP /var/lib/docker/ /new/path/docker

At this stage we can safely start docker daemon:

# systemctl start docker

Confirm that docker runs within a new data directory:

#  ps aux | grep -i docker | grep -v grep
root      2095  0.2  0.4 664472 36176 ?        Ssl  18:14   0:00 /usr/bin/docker daemon -g  /new/path/docker -H fd://
root      2100  0.0  0.1 360300 10444 ?        Ssl  18:14   0:00 docker-containerd -l /var/run/docker/libcontainerd/docker-containerd.sock --runtime docker-runc

All done.

2018/11/26

Selinux – Permission denied on accessing host directory in docker

Filed under: Docker — Mathz @ 11:18

chcon -Rt svirt_sandbox_file_t /path/to/volume

2018/08/30

Zoneminder in Docker

Filed under: Docker,Server — Mathz @ 17:15

docker swarm init
docker stack deploy -c docker-compose.yml zm
echo “wait for a few seconds to MySQL start for the first time”
docker service scale zm_web=1
echo “go to ZoneMinder console Options-Servers and declare node.0->stream0.localhost and node.1 … node.3, finally start”
docker service scale zm_stream=3
docker service ls

Good debug commands
sudo docker service ps zm_web
sudo docker service ls
sudo docker service rm

2018/08/29

Docker

Filed under: Docker,Server — Mathz @ 20:37

docker build

docker-compose up

docker ps

docker exec -i -t <NAMES> /bin/bash

docker logs <NAMES>

docker-compose.yaml

version: '3'
services:
influxdb:
image: influxdb:1.5.4
restart: always
volumes:
- /media/space/dockerVolumes/influxdb.1.5.4:/var/lib/influxdb
ports:
- 8086:8086

/lib/systemd/system/docker.service with your favorite text editor and replace the following line where /new/path/docker is a location of your new chosen docker directory:
FROM:
ExecStart=/usr/bin/docker daemon -H fd://
TO:
ExecStart=/usr/bin/docker daemon -g /new/path/docker -H fd://

Powered by WordPress