Docker Cheat Sheet

Docker Cheatsheet:

# pull/update an image
$ docker pull ghcr.io/shaarli/shaarli:release
# run a container from an image
$ docker run ghcr.io/shaarli/shaarli:latest
# list available images
$ docker images ls
# list running containers
$ docker ps
# list running AND stopped containers
$ docker ps -a
# run a command in a running container
$ docker exec -ti <container-name-or-first-letters-of-id> bash
# follow logs of a running container
$ docker logs -f <container-name-or-first-letters-of-id>
# delete unused images to free up disk space
$ docker system prune --images
# delete unused volumes to free up disk space (CAUTION all data in unused volumes will be lost)
$ docker system prune --volumes
# delete unused containers
$ docker system prune

Emergency Docker Downgrade

Docker update screws up Casaos or some other application on your server and you need a quick Docker Downgrade? I had the same issue and just downgraded docker back to 28.5.2 and it instantly fixed the issue. Here are the steps if you need them for ubuntu: Stop Docker sudo systemctl stop docker Install the specific Docker version sudo apt install docker-ce=5:28.5.2-1~ubuntu.24.04~noble \ docker-ce-cli=5:28.5.2-1~ubuntu.24.04~noble \ containerd.io Prevent Ubuntu from automatically upgrading Docker: sudo apt-mark hold docker-ce docker-ce-cli Start Docker again sudo systemctl start docker sudo systemctl enable docker Verify the version docker --version You should see: [Read More]

Missing Git Submodules?

Here’s something I stumble over almost every time I clone a git repository with submodules. Those darn folders are empty and using the project fails. Here are two ways to fix that: Clone With The Recursive Flag When issuing your git clone, add a --recursive flag. It will look like this: $ git clone git@github.com:user/project.git --recursive And as easy as that, your submodules are there. If you cloned your repo and don’t mind starting over - delete the freshly cloned repository and add that --recursive to the command. [Read More]

Mount a remote rsync.net filesystem in Linux

Rysync.net rules for backups To mount a remote rsync.net filesystem in Linux, you can use the rsync command with the --mount option. This option allows you to mount a remote directory as a local filesystem, enabling you to access and manipulate files as if they were on a local disk. Here’s an example command: rsync -avz --mount --remote-option=--mount-options=sync=meta,attr rsync://username:password@rsync.net/path/to/remote/directory /local/mount/point Replace: username and password with your actual rsync.net credentials rsync.net/path/to/remote/directory with the actual path to the remote directory you want to mount /local/mount/point with the desired local mount point The --remote-option flag specifies the --mount-options option, which configures the mount. [Read More]

To enable copy-paste between a QEMU host and guest

To enable copy-paste between a QEMU host and guest, install spice-vdagent (or guest tools) in the guest OS, ensure it’s running, and use the SPICE display protocol for seamless clipboard sharing, often requiring the virtio-serial device and correct QEMU arguments in your setup. For Windows guests, you may also need to install VirtIO drivers, and for Linux guests, ensure the service starts correctly after X starts. For Linux Guests (e.g., Ubuntu, Fedora) [Read More]

Using multiple github accounts with ssh keys

Using multiple github accounts with ssh keys. Generate ssh key pairs for accounts and add them to GitHub accounts. Edit/Create ssh config file (~/.ssh/config): # Default github account: oanhnn Host github.com HostName github.com IdentityFile ~/.ssh/oanhnn_private_key IdentitiesOnly yes # Other github account: superman Host github-superman HostName github.com IdentityFile ~/.ssh/superman_private_key IdentitiesOnly yes NOTE: If you use any account frequently, you should use the default hostname (github.com). Add ssh private keys to your agent: [Read More]
git  ssh  howto