Using Podman on Arco Linux

My scenario for using podman at first was due to not being allowed to use docker due to their licensing, and my company being over the threshhold for using docker without purchasing a license, and my company wasn’t interested in purchasing docker, as I was the only developer interested in placing my local database in a docker container, more later as to why I want it off of my computer and just in a container.

Now most of these steps should work on different linux distro’s and even mac, albeit the commands might be a little bit different on each. Mac would obviously use brew and then other distros will use apt-get or dnf.

Install podman

Open a terminal and lets install podman

sudo pacman -S podman

After the install is complete, run:

podman info

Now if you’re like me, you will get the following error at the top of the command:

ERRO[0000] cannot find UID/GID for user austin: open /etc/subuid: no such file or directory - check rootless mode in man pages.
WARN[0000] Using rootless single mapping into the namespace. This might break some images. Check /etc/subuid and /etc/subgid for adding sub*ids if not using a network user

Now if you don’t see this error message, you can go ahead and ignore the next section and move on to downloading the images

Making podman rootless

First off, lets install a package called slirp4netns This will allow us to run podman without needing to sign in as root or use sudo For me, the package is in the AUR

paru slirp4netns

The result of the command should look something like this (If you are using the AUR)

2 aur/slirp4netns-git v1.1.12.r2.g631f361-1 [+2 ~0.01]
  User-mode networking for unprivileged network namespaces.
1 community/slirp4netns 1.1.12-1 [0B 74.92KiB] [Installed]
  User-mode networking for unprivileged network namespaces
:: Packages to install (eg: 1 2 3, 1-3):

I selected option 1, from the community.

After that’s installed run

podman system migrate

Now we should be able to run podman info and we won’t get that error message. This means that we’re now ready to start pulling down some images and starting up our databases in podman.

If you’re still getting that error message, then lets add some entries into the subuid and subgid files

I did not have those files created initially, so I had to run

sudo touch /etc/subgid
sudo touch /etc/subuid

After you have run that, we can run

usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER

This will add some ranges for the current user account.

Once we have run this, run podman system migrate, and now when we run podman info, velluah, no more error messages

Bonus - Search may not work by default

On linux I ran into the issue that when I used podman search, I would never get results So I had to go and hop into the github repo for podman and in the issues I found the fix. Here’s the link for the thread discussion: https://github.com/containers/podman/issues/8896 I’ll post the solution really quick here though. Edit your /etc/containers/registries.conf file and add the following line:

unqualified-search-registries=["registry.access.redhat.com", "registry.fedoraproject.org", "docker.io"]

now when you run commands like podman search postgres, you will get a list of results returned back to you.

Installing Sql Server

You can search for sql server instance and use one you would like, I’ll go ahead and provide the one that I am using.

podman pull mcr.microsoft.com/mssql/server:2019-latest

to ensure that this pulled correctly, we can run:

podman images

and we should now find sqlserver in that instance, it will look something like the following.

podman images
REPOSITORY                      TAG          IMAGE ID      CREATED       SIZE
mcr.microsoft.com/mssql/server  2019-latest  d78e982c2f2b  3 months ago  1.49 GB

Lets now create a spot for that sql server data to sit.

sudo mkdir /var/mssql
sudo touch /var/mssql/data
sudo chmod 755 -R /var/mssql/data

Now we can run the following command, anything with {$…} is something you should change with your own values

podman run -d -e 'ACCEPT_EULA=Y' -e
'MSSQL_SA_PASSWORD={$SA_PASSWORD}'
--name {$NAME_OF_POD_INSTANCE}
-p 1460:1433
-v /var/mssql/data:/var/mssql/data:Z
mcr.microsoft.com/mssql/server:2019-latest

As long as everything has gone well, we can now run

podman start {$NAME_OF_POD_INSTANCE}

Now you have successfully created a sql server instance that can be started and stopped on command.

podman start {$NAME_OF_POD_INSTANCE}
podman stop {$NAME_OF_POD_INSTANCE}

are the two commands you need to know. Now if you’re going to connect to this with a GUI client, make note that we are using port 1460, and you’ll want to click the value to trust server certificate.

Install postgres

podman search postgres

I get a whole list of options, I am going to go with this one:

docker.io/library/postgres

so following the same process that we did for sql server, we can run

podman pull docker.io/library/postgres

After this is installed, lets create our container

podman run -dt --name {$NAME_OF_POD_INSTANCE} -e POSTGRES_PASSWORD={$POSTGRES_PASSWORD} -p 5432:5432 postgres

Upon running the command, you should get a long guid type string

we can run

podman ps

to validate that the container was in fact created.

now we can run

podman start {$NAME_OF_POD_INSTANCE}

and just like that, we now have Postgres, and Sql server running in containers on our machine.