The origin of the docker names

I thought the docker names were infinite, but if I need to believe what my2cents says about this (btw image also taken fro the article) it is not the case. It’s just a go algorithm that literally picks up a name and an adjetive from a hardcoded list. Here you have a running example and the github code. How boring explanation. It’s not aliens trying to communicate or a desperate AI doing the same πŸ˜€

Taskcafe, an open source project management tool

In my eternal search for a good and free project management tool I’ve found this little jewel called Taskcafe. I went for a docker installation without changing an iota of the installation procedure, we clone the repository:

git clone https://github.com/JordanKnott/taskcafe && cd taskcafe

Now do the following:

docker-compose -p taskcafe up -d

This will start a postgres instance as well as a taskcafe instance, so two dockers, taskcafe_web_1 and taskcafe_postgres_1. But how do I log in? Fortunately there’s a trend about it. Just replace the end of the URL you got by /register. After getting my admin, the rest is easy. I create my first project, then I add lists to it, and cards. That’s it. Up and running! Beautiful ❀

A jupyter notebook in a docker: Jupyter Docker Stacks

Again I’m with python. I want to run as package independent as possible, so I want to run the external python apps in a docker. If we have a jupyter notebook, we can easily run it this way if we have it in a “test” folder. Note that the “test” folde needs to be readable for everyone (777) or you’ll get this error :

tornado.web.HTTPError: HTTP 403: Forbidden

Anyway, this is what I get when I run my docker mapping the test folder:

# > docker run -p 8888:8888 -v "${PWD}"/test:/home/jovyan/work 
jupyter/scipy-notebook
Entered start.sh with args: jupyter lab
Executing the command: jupyter lab
[I DATE ServerApp] jupyter_server_terminals
| extension was successfully linked.
[I DATE ServerApp] jupyterlab
| extension was successfully linked.
[W DATE NotebookApp] 'ip' has moved from NotebookApp
to ServerApp. This config will be passed to ServerApp.
Be sure to update your config before our next release.
[W DATE NotebookApp] 'ip' has moved from NotebookApp
to ServerApp. This config will be passed to ServerApp.
Be sure to update your config before our next release.
[I DATE ServerApp] nbclassic
| extension was successfully linked.
[I DATe ServerApp] Writing Jupyter server cookie secret
to /home/jovyan/.local/share/jupyter/runtime/jupyter_cookie_secret
[I DATE ServerApp] notebook_shim
| extension was successfully linked.
[I DATE ServerApp] notebook_shim
| extension was successfully loaded.
[I DATE ServerApp] jupyter_server_terminals
| extension was successfully loaded.
[I DATE LabApp] JupyterLab extension loaded from
/opt/conda/lib/python3.10/site-packages/jupyterlab
[I DATE LabApp] JupyterLab application directory
is /opt/conda/share/jupyter/lab
[I DATE ServerApp] jupyterlab
| extension was successfully loaded.
[I DATE ServerApp] nbclassic
| extension was successfully loaded.
[I DATE ServerApp] Serving notebooks
from local directory: /home/jovyan
[I DATE ServerApp] Jupyter Server 2.1.0 is running at:
[I DATE ServerApp] http://XXX:8888/lab?token=XXX
[I DATE ServerApp] or http://127.0.0.1:8888/lab?token=XXX
[I DATE ServerApp] Use Control-C to stop this server
and shut down all kernels (twice to skip confirmation).
[C DATE ServerApp]

To access the server, open this file in a browser:
file:///home/jovyan/.local/share/jupyter/runtime/jpserver-7-open.html
Or copy and paste one of these URLs:
http://XXX:8888/lab?token=XXX
or http://127.0.0.1:8888/lab?token=XXX

The Jupyter Docker stack documentation is available here. Happy docking!

A LimeSurvey in a docker: make it a quick and dirty

You may need to ask your colleagues about something at one point, I’m sure about it. But I’m sure about also that you don’t have time, neither hardware, to program an entire survey or to install the software in a specific server. Since I’m lazy also, as you know, I looked for a docker solution until I found one that does the job. The basic principles of a lime survey you get on this post. This will work if your docker station has a mysql database – you will be asked to connect to the database. If you don’t have, or you don’t want to use it, we need a compose with a mysql docker.

It is worth to mention all the docker images I found. I hope it saves you googling time! 😁😁. So here you have the crramirez limesurvey image, with a pseudo-docker compose. And here you have the martialblog limesurvey, with a lot of possible customisations. Me, I’m a simple person. I don’t want to play with customisation, I want to download a compose file and get the thing working out of the box. This goal you can achieve with the acspri limesurvey. In short (or TLTR) 😁😁😁: make a folder and copy this into a docker-compose.yml file.

version: '2'
services:
limesurvey:
image: acspri/limesurvey
ports:
- 8082:80
environment:
LIMESURVEY_DB_PASSWORD: example
LIMESURVEY_ADMIN_USER: admin
LIMESURVEY_ADMIN_PASSWORD: password
LIMESURVEY_ADMIN_NAME: Lime Administrator
LIMESURVEY_ADMIN_EMAIL: lime@lime.lime
volumes:
- ./plugins:/var/www/html/plugins
- ./upload:/var/www/html/upload
- ./config:/var/www/html/application/config
mysql:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example

As usual, careful with the formattingΒ if you cut’n’paste from above. Once you have this file in a folder in the computer with dockers up and running, just type

docker-compose up -d

And access to:

Frontend (what you send to the people)

http://localhost:8082/

Backend (to create the survey)

http://localhost:8082/index.php/admin

I’m not going to dig more, since now it’s time to write the survey. Don’t forget to check how to configure the default answers and how to export the results. If anyone is interested, that is not always the case 😩😩😩.

HOWTO: upgrade docker-compose on CentOS 7.X

The default docker-compose that we get from yum on CentOS 7.X is pretty old. Let’s start by installing it and checking version number:

## > yum install docker-compose
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.fau.de
* centosplus: ftp.rz.uni-frankfurt.de
* epel: mirror.imt-systems.com
* epel-testing: mirror.imt-systems.com
* extras: ftp.rz.uni-frankfurt.de
* rpmfusion-free-updates: mirror.netsite.dk
* updates: ftp.rrzn.uni-hannover.de
Resolving Dependencies
--> Running transaction check
---> Package docker-compose.noarch 0:1.18.0-4.el7
will be installed
Installed:
docker-compose.noarch 0:1.18.0-4.el7
Dependency Installed:
python36-PyYAML.x86_64 0:3.13-1.el7
python36-cached_property.noarch
0:1.5.1-2.el7 python36-chardet.noarch
0:3.0.4-1.el7 python36-docker.noarch
0:2.6.1-3.el7 python36-docker-pycreds.noarch
0:0.2.1-2.el7 python36-dockerpty.noarch 0:0.4.1-18.el7
python36-docopt.noarch 0:0.6.2-8.el7
python36-idna.noarch 0:2.10-1.el7
python36-jsonschema.noarch 0:2.5.1-4.el7
python36-pysocks.noarch 0:1.6.8-7.el7
python36-requests.noarch 0:2.14.2-2.el7
python36-six.noarch 0:1.14.0-3.el7
python36-texttable.noarch 0:1.6.2-1.el7
python36-urllib3.noarch 0:1.25.6-2.el7
python36-websocket-client.noarch 0:0.47.0-2.el7
Complete!
## > docker-compose -v
docker-compose version 1.18.0, build 8dd22a9

As you see, it’s pretty old. So we uninstall it yum remove docker-compose, and get the latest binary from the repository like this:

## > VERSION=$(curl --silent \ https://api.github.com/repos/docker/compose/releases/latest \
| grep -Po '"tag_name": "\K.*\d')
## > DESTINATION=/usr/local/bin/docker-compose
## > curl -L \ https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) \
-o $DESTINATION
100 42.4M 100 42.4M 0 0 45.9M 0 --:--:-- 45.9M
## > chmod 755 $DESTINATION

After this, we log out and log in again to get a new shell and now…

## > docker-compose -v
Docker Compose version v2.11.2

Which is much better.

HOWTO : install WordPress in a local computer with a docker

The first page. Image taken from here.

Like everything we do with dockers, this procedure is a little bit dark but it works out of the box. I will suppose you already have docker installed. I’m running on CentOS 7.X, that is my current weapon of choice. I am following the official docker WordPress image installation instruction. In principle it’s working out of the box with the one-liner

$ docker run --name my-wp --network some-network -d wordpress

The installer quickly appears on 0.0.0.0:8080, but we are asked for database to connect. I do have a database, but the idea is to reduce “coding” to the minimum, so I go for the next recipe, with a docker compose. With the small modification of my server IP (1.2.3.4) I take the sample yml from the official page but I save it as :

version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 1.2.3.4:8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:

In my prompt, I simply type:

## > docker-compose up -d
Creating wordpress_wordpress_1 ... done
Creating wordpress_db_1 ... done

And after that I go to 1.2.3.4:8080 to start the installer. As we can read above, we now have two dockers, one for the database and one for the wordpress engine. Filling up the next details for the admin is trivial, and we end up with a page like the one above (template Twenty-Twenty-Two). New user creation is also working without issues. We’ll see if the client is happy with it also! πŸ˜‰

The systemd-analyze and daemon management on Linux

I feel like I need to write down this.I was fighting with a rebel docker process in a multi-purposed server so I was forced to review the services. First thing I did is to check the starting time of each service. You can find a detailed post in the geekdiary. This is done like this

systemd-analyze blame

I’m not going to copy my output, but I’ll say I didn’t find any clear culprit. Here you have the official systemd-analyze man page. Let’s say I really suspect of the docker daemon. Where’s the service file? We can cat the service like this (partial output):

root@bad ~ ## > systemctl cat docker
# /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
...

As you see, it gives you the location of the file as well as the content. Now I can change the timeout, or the restart options, or whatever I want. I go anyway for reinstalling the service completely (docker) and reviewing my docker monitoring code, so that it doesn’t make so many calls to the daemon, and after that my service lagging problem is gone. BTW my docker error is described here. Long story short, there was nothing wrong with the service but with my code. So review your code and test it as much as you can! πŸ˜‰

An Ansible Semaphore docker : run ansible with a GUI

Image taken from the website.

I’ve been posting about ansible for a while. You should know what you can do with it already. By defining tasks and an inventory, you can decide what to install, how and where. These recipees can be files on a folder or they could be nicely organized on a website. The Ansible Semaphore is a website that is letting you do it, at least, the physical install lets. I’ve tried the docker install, that is going to let you play with it but it comes with the corresponding isolation issues. Here you have the github page. Step by step, what I did on a CentOS client with dockers. First I create a folder for the project (semaphore) and docker-compose.yml as in the documentation. Then it’s very simple. Inside the folder, type

docker-compose up

That’s it. Go to https://localhost:3000 and enjoy your semaphore. Unfortunately it’s empty and we don’t have any ssh key, user, etc. But that’s not the important thing, right? The important thing is that all the functionalities are there. And that it’s modern, and mobile-phone friendly πŸ˜‰. Anyway. Here’s the guide about how to install semaphore for real. And if you don’t like the GUI, you can also try the AWX GUI. A separate article may come 😏.

HOWTO: install docker on debian 11

I’m a CentOS user, but it’s good to be open-minded. The debian systems are not managed in the same way than CentOS, so it’s not a stupid question if the installation instructions work out of the box. I will follow the official documentation for debian. I have root access to the machine, so no sudo needed. Let’s see:

> apt-get remove docker docker-engine docker.io containerd runc
> apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
> mkdir -p /etc/apt/keyrings
> curl -fsSL https://download.docker.com/linux/debian/gpg \
| gpg --dearmor -o /etc/apt/keyrings/docker.gpg
> echo \
  "deb [arch=$(dpkg --print-architecture) \
signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
| tee /etc/apt/sources.list.d/docker.list > /dev/null
> apt-get update
> apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

After the above lines “docker run hello-world” works. This exercise was indeed mildly boring 😩. Or could it be I’m running on the wrong distro? 🧐

Plotty: a dash docker to plot data with python on a webpage

The sample plot. Image taken from this post.

If I want to be called a data scientist I need to know how to easily show my numbers. This means python, but not only, also an easy way to export in an app your results. I found out that you can achieve most of it with a docker. As usual, I will assume you have a healthy docker environmet. We will follow this github page but you can install it for real if you follow this guide. Actually I would keep both in mind to understand the whole thing. Briefly then:

  1. Clone the repo. git clone https://github.com/yaojiach/docker-dash.git
  2. Cd to the folder and build the docker. docker build -f Dockerfile.dev -t docker-dash-example-dev .
  3. Run it. docker run -d -p 8050:8050 -v "$(pwd)"/app:/app --rm docker-dash-example-dev

That’s it. If you go now to http://localhost:8050 you should get a plot similar to the one above. Obviously you don’t want to plot the fruits consumed per american city or whatever that is. I’m pretty sure I don’t need to tell you how to modify that, but there’s that app folder on the thing you donwloaded on step 1. Open app.py and have a look. There you have it! Just modify it according to your needs… πŸ˜‰…