Running MariaDB with podman

I need to run MariaDB for DigiKam. I want to use container.

Are there any ready to use container images I can download or I need to build from scratch?

1 Like

Does this help you?
Overview - container/mariadb - src.fedoraproject.org

2 Likes

as simple as:

sudo dnf install podman-compose

Example docker-compose.yml for mariadb :

# Use root/example as user/password credentials
version: '3.1'

  services:
    db:
      image: mariadb:latest
      volumes:
        - /tmp/dc-test-db:/var/lib/mysql
      ports:
        - 3306:3306
      environment:
        MYSQL_ROOT_PASSWORD: your-password-here
      restart: always

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

Start the container:

podman-compose up -d

Stop container

podman-compose down

Regards.,

REFERENCES

https://hub.docker.com/_/mariadb
https://hub.docker.com/_/adminer/
https://www.adminer.org/

Regards.,

2 Likes

Got similar result when doing podman-compose -f file up

podman-compose  -f docker-compose.yml up
using podman version: podman version 3.1.2
Traceback (most recent call last):
  File "/usr/bin/podman-compose", line 33, in <module>
    sys.exit(load_entry_point('podman-compose==0.1.7.dev0', 'console_scripts', 'podman-compose')())
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 1419, in main
    podman_compose.run()
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 825, in run
    self._parse_compose_file()
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 894, in _parse_compose_file
    content = yaml.safe_load(f)
  File "/usr/lib64/python3.9/site-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib64/python3.9/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib64/python3.9/site-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/usr/lib64/python3.9/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib64/python3.9/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib64/python3.9/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib64/python3.9/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib64/python3.9/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib64/python3.9/site-packages/yaml/parser.py", line 438, in parse_block_mapping_key
    raise ParserError("while parsing a block mapping", self.marks[-1],
yaml.parser.ParserError: while parsing a block mapping
  in "/var/home/fcc/MariaDB/docker-compose.yml", line 2, column 1
expected <block end>, but found '<block mapping start>'
  in "/var/home/fcc/MariaDB/docker-compose.yml", line 4, column 3

And I found this Manage containers with Podman Compose - Fedora Magazine

Following the example yaml:

$ podman-compose  -f fm.yaml up
using podman version: podman version 3.1.2
podman pod create --name=mariadb --share net -p 8080:80 -p 6603:3306
2afb4522d78921f683d2546ad2013d11edeb9fa7b020772d70ee9bb3f5e9cd57
0
podman volume inspect mariadb_wpdbvol || podman volume create mariadb_wpdbvol
Error: error inspecting object: no such volume mariadb_wpdbvol
podman create --name=mariadb_db_1 --pod=mariadb --label io.podman.compose.config-hash=123 --label io.podman.compose.project=mariadb --label io.podman.compose.version=0.0.1 --label com.docker.compose.container-number=1 --label com.docker.compose.service=db -e MYSQL_DATABASE=magazine -e MYSQL_USER=magazine -e MYSQL_PASSWORD=1maGazine! -e MYSQL_ROOT_PASSWORD=1maGazine! -v mariadb_wpdbvol:/var/lib/mysql --add-host web:127.0.0.1 --add-host mariadb_web_1:127.0.0.1 --add-host db:127.0.0.1 --add-host mariadb_db_1:127.0.0.1 --restart always mariadb:10.5
âś” registry.fedoraproject.org/mariadb:10.5
Trying to pull registry.fedoraproject.org/mariadb:10.5...
  manifest unknown: manifest unknown
Error: Error initializing source docker://registry.fedoraproject.org/mariadb:10.5: Error reading manifest 10.5 in registry.fedoraproject.org/mariadb: manifest unknown: manifest unknown
125
podman volume inspect mariadb_wordpress || podman volume create mariadb_wordpress
Error: error inspecting object: no such volume mariadb_wordpress
podman create --name=mariadb_web_1 --pod=mariadb --label io.podman.compose.config-hash=123 --label io.podman.compose.project=mariadb --label io.podman.compose.version=0.0.1 --label com.docker.compose.container-number=1 --label com.docker.compose.service=web -e WORDPRESS_DB_HOST=db -e WORDPRESS_DB_USER=magazine -e WORDPRESS_DB_NAME=magazine -e WORDPRESS_DB_PASSWORD=1maGazine! -e WORDPRESS_TABLE_PREFIX=cz -e WORDPRESS_DEBUG=0 -v mariadb_wordpress:/var/www/html --add-host web:127.0.0.1 --add-host mariadb_web_1:127.0.0.1 --add-host db:127.0.0.1 --add-host mariadb_db_1:127.0.0.1 --restart always wordpress
âś” registry.fedoraproject.org/wordpress:latest
Trying to pull registry.fedoraproject.org/wordpress:latest...
  manifest unknown: manifest unknown
Error: Error initializing source docker://registry.fedoraproject.org/wordpress:latest: Error reading manifest latest in registry.fedoraproject.org/wordpress: manifest unknown: manifest unknown
125
podman start -a mariadb_db_1
Error: no container with name or ID "mariadb_db_1" found: no such container
125
podman start -a mariadb_web_1
Error: no container with name or ID "mariadb_web_1" found: no such container
125

Thanks for the pointer!

In the document, “how to get the image” is not mentioned.

Need more study.

1 Like

Docker
There i saw the command docker pull mariadb as we work with podman i used podman pull mariadb:latest >> you get asked then from where you want to download the images … i chosen docker. And then same for adminer (to access the db over a webgui).

MariaDB 10.3 SQL Database Server Docker image
This container image includes MariaDB 10.3 SQL database server for OpenShift and general usage. Users can choose between RHEL, CentOS and Fedora based images. The RHEL images are available in the Red Hat Container Catalog, the CentOS images are available on Docker Hub, and the Fedora images are available in Fedora Registry. The resulting image can be run using podman.

1 Like

Thank you very much!

podman pull success!

2 Likes

I got SELinux issues on Fedora 39.

time->Sun Feb 18 23:11:27 2024
type=AVC msg=audit(1708297887.513:7956): avc:  denied  { write } for  pid=108658 comm="mariadbd" name="dc-test-db" dev="tmpfs" ino=185 scontext=system_u:system_r:container_t:s0:c226,c727 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=dir permissive=0
----
time->Sun Feb 18 23:11:27 2024
type=AVC msg=audit(1708297887.528:7957): avc:  denied  { setattr } for  pid=108664 comm="chown" name="dc-test-db" dev="tmpfs" ino=185 scontext=system_u:system_r:container_t:s0:c226,c727 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=dir permissive=0

version: '3.1'

services:

  db:
    image: mariadb
    restart: always
    volumes:
      - ./data:/var/lib/mysql:z
    ports:
      - 3306:3306
    environment:
      MARIADB_ROOT_PASSWORD: changeme!!

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

Solution: Add :z to the volume

Just to note did you

podman pull mariadb ?

Didn’t have to