I would show you how to install podman the alternative docker. The difference between docker and podman is
- docker: Running the docker daemon to operate the containers.
- podman: Do not need to run a daemon to operate the containers. As a initial setting, users need to run it by root authority. But after a setting, they can use podman from user authority. That's useful.
How to install and run podman with rootless
$ sudo dnf install -y podman
Then to run podman from user authority, add below lines to the files
$ cat /etc/subuid ... your_account_name:100000:65536
$ cat /etc/subgid ... your_account_name:100000:65536
Useful podman commands
There a compatibility between them, just replacing
docker something with
But podman does not support docker-compose.
The specific useful commands too.
--debug option for
podman info is podman specific.
$ podman info --debug
Before next blog for
qemu-user-static. I would write some articles.
How to remove not removed container images
The subject is that I faced.
The reason is after upgrading a docker, the actual storage to manage containers were changed.
docker image ls command could still see the containers.
docker rmi or
docker system prune can not detect the containers to remove it internally.
- A: A docker old version: actual storage is at
- B: A docker new version: actual storage is at
So, when I faced this situation, what I did is blew steps.
$ sudo systemctl stop docker $ sudo rm -rf /var/lib/docker $ sudo systemctl start docker
systemctl start docker, the new
/var/lib/docker is created in the process.
Useful docker commands
docker image ls -a
To show all the container images including intermediate images.
docker system prune -f -a --volumes
It is useful to remove all the container image. The created images often occupy your hard disk.
$ docker system prune --help Usage: docker system prune [OPTIONS] Remove unused data Options: -a, --all Remove all unused images not just dangling ones --filter filter Provide filter values (e.g. 'label=<key>=<value>') -f, --force Do not prompt for confirmation --volumes Prune volumes
Useful information such as a storage driver and registry.
To know the version.
docker image build --rm -t sample/foo .
image can be ommited. But I prefer to show it explicitly.
When building, adding
--rm is very important to reduce the container image size.
But it seems the default is true for my docker.
$ docker image build --help ... --rm Remove intermediate containers after a successful build (default true)
Adding namespace "sample" is important to distinguish current focusing domain.
docker container run --rm
In case to create a small container image. busybox is useful.
container can be omitted. But I prefer to show it explicitly.
$ docker container run --rm -t busybox uname -a Linux 29722d64ab62 5.0.5-200.fc29.x86_64 #1 SMP Wed Mar 27 20:58:04 UTC 2019 x86_64 GNU/Linux
$ docker container run --help ... --rm Automatically remove the container when it exits ...