№ 10374 В разделе "Sysadmin"
от October 25th, 2019,
В подшивках: Docker
Stop Docker daemon and move /var/lib/docker to new place, for example /mnt/HC_Volume_3397296/docker
Create file /etc/docker/daemon.json with contents:
{ "data-root": "/mnt/HC_Volume_3397296/docker" }
Now start daemon.
Read more about Docker config file https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
№ 10098 В разделе "Sysadmin"
от June 25th, 2019,
В подшивках: Docker
To remove old images (in my case images can’t be older 14 days) I used https://github.com/andrey-pohilko/registry-cli and included registry tools to collect garbage.
Make sure you run your registry with REGISTRY_STORAGE_DELETE_ENABLED=true
docker run -d -p 127.0.0.1:5000:5000 -e "REGISTRY_STORAGE_DELETE_ENABLED=true" --restart always \ --name docker-images-registry \ -v /srv/registry/data:/var/lib/registry \ -v /srv/registry/users:/auth/htpasswd registry:2
Now you can delete images
docker run --rm --link docker-images-registry anoxis/registry-cli \ -r http://docker-images-registry:5000 --delete --keep-by-hours 336 \ --keep-tags-like latest --digest-method=GET
Ok, use garbage collector
docker stop docker-images-registry docker run --rm -v /srv/registry/data:/var/lib/registry \ -v /srv/registry/users:/auth/htpasswd registry:2 \ bin/registry garbage-collect /etc/docker/registry/config.yml docker start docker-images-registry
Well done! Take a donut from a shelf.
№ 9577 В разделе "Sysadmin"
от November 25th, 2018,
В подшивках: Cron, Docker
At first, create your cron file with usual crontab lines and name it mycrontab_lines
*/5 * * * * /app/cron_script.sh
Now create your cron_script.sh
#!/bin/bash # load env variables source /etc/profile . ~/.profile python3 /app/mycronapp.py
Ok, you ready now to create Dockerfile like this:
FROM python:3 # install cron service RUN apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_PERSISTENT} -y install cron && \ apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* # bla bla bla copy app.py WORKDIR /app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # install python app COPY app.py . COPY mycronapp.py . # make cron COPY mycrontab_lines . COPY cron_script.sh . RUN chmod 0755 run_previewer.sh RUN chmod 0644 mycrontab_lines RUN crontab mycrontab_lines # start cron service before start blocking application CMD service cron start && \ python ./app.py
Build and run container.
№ 9569 В разделе "Sysadmin"
от November 23rd, 2018,
В подшивках: Docker
Yes! This is legendary SBNC! Used repositories of Ubuntu 16.04 to get it and build this precious Docker image.
Place in /srv/docker/sbnc/home your predefined config files, it is a user’s home directory and stored in $HOME.
Sample config files:
$HOME/sbnc/sbnc.conf
system.users=vlad system.port=9000 system.ip=0.0.0.0 system.md5=0
$HOME/sbnc/users/vlad.conf
user.password=myultrasecurepassword user.server=irc.tomsk.net user.realname=21h user.port=6669 user.nick=vlad user.admin=1 user.seen=1542914743 user.autobacklog=on user.channels=#linux
Now you are ready to run it:
docker run -d --name sbnc \ -v /srv/docker/sbnc/home:/var/lib/sbnc \ -p 9000:9000 \ --restart=always iam21h/sbnc
DO NOT FORGET TO SET RIGHT FILES PERMISSIONS ON CONFIG DIRECTORIES AND FILES!
Docker HUB https://hub.docker.com/r/iam21h/sbnc/
Source https://git.blindage.org/21h/docker-shroudBNC
Fortune cookie: The only alliance I would make with the Women's Liberation Movement is in bed. -- A. Hoffman