• 0 Posts
  • 63 Comments
Joined 2 years ago
cake
Cake day: June 13th, 2023

help-circle














  • To do some further testing, I added a mariadb container to the pod, added mycli to the alpine container, and was able to connect to the mariadb database from the alpine container.

    podman run -dt --pod testpod --restart unless-stopped --name testdb --env MARIADB_ROOT_PASSWORD=a_secret_pass \
    --volume:/fake/path/databases:z docker.io/library/mariadb:11.2
    

    This command is all one-line, but I added a line break for readability. I used MariaDB 11.2 because that’s what I had on-hand from another project. Note the “:z” in the volume – this is due to SELinux needing to give podman access to that directory.

    podman exec -it alpine apk add mycli
    
    podman exec -it alpine mycli -u root -p a_secret_pass
    

    This connects to the database successfully and, as you can see, looks as if the database is running right within Alpine; however, the database is not accessible outside of the pod.

    It’s also worth noting that I had some trouble initially accessing a webapp from outside of my VM which was hosting the container. This was due to firewalld blocking the connection. Since I’m using AlmaLinux with SELinux, I had to add a firewalld rule to allow traffic on port 8080.

    edit: 1) a capital was missed | 2) added info about firewalld




  • I had the same issues when I first started out with podman. The solution I found was to make a pod and place the containers within the pod. They’ll be able to access each other through localhost:port. If you need ports published outside the pod, then they’ll need to be specified during pod creation.

    I didn’t use podman-compose, so I can’t speak specifically to how you’ll go about this with a compose yaml.

    It took many pages of websites for me to find something I understood. I’ll see if I can find which websites I used and post them in a bit.