Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues when trying to run the container with Podman #1082

Open
5 tasks done
plb-42 opened this issue Dec 27, 2024 · 4 comments
Open
5 tasks done

Issues when trying to run the container with Podman #1082

plb-42 opened this issue Dec 27, 2024 · 4 comments

Comments

@plb-42
Copy link

plb-42 commented Dec 27, 2024

Describe the bug

I am using podman instead of docker, and while they're mostly interoperable, there seems to be an issue with my setup that prevents me from running podfetch as a rootless podman container.

For testing purposes, I have turned the docker-compose file from the Documentation into the following podman command:

podman run -d \
  --name podfetch \
  --user 1000:1000 \
  -p 80:8000 \
  -v /var/Podfetch/db:/app/db \
  -v /var/Podfetch/podcasts:/app/podcasts \
  -e POLLING_INTERVAL=60 \
  -e SERVER_URL=http://localhost:80 \
  -e DATABASE_URL=sqlite:///app/db/podcast.db \
  samuel19982/podfetch:latest

Running this results in a container that immediately exits, with the following log:

Debug file located at /home/rust/src/target/x86_64-unknown-linux-musl/release/build/podfetch-2ea4860fb8f89ab4/out/built.rs

  ____           _ _____    _       _
 |  _ \ ___   __| |  ___|__| |_ ___| |__
 | |_) / _ \ / _` | |_ / _ \ __/ __| '_ \
 |  __/ (_) | (_| |  _|  __/ || (__| | | |
 |_|   \___/ \__,_|_|  \___|\__\___|_| |_|

        


2024-12-27T09:35:08 ℹ️ - Starting with the following environment variables:
2024-12-27T09:35:08 ℹ️ - Public server url: http://localhost:80/
2024-12-27T09:35:08 ℹ️ - Polling interval for new episodes: 60 minutes
2024-12-27T09:35:08 ℹ️ - Developer specifications available at http://localhost:80/swagger-ui/index.html#/
2024-12-27T09:35:08 ℹ️ - GPodder integration enabled: false
2024-12-27T09:35:08 ℹ️ - Podindex API key&secret configured: false


2024-12-27T09:35:08 ❌ - Error connecting to postgres://postgres:postgres@postgres:5432/podfetch with reason Invalid connection url for multiconnection

When removing the database URL and the downloads, instead running the container with

podman run -d \
  --name podfetch \
  -p 80:8000 \
  -e POLLING_INTERVAL=60 \
  samuel19982/podfetch:latest

it runs, and the webinterface is reachable via serverIP:80, and works fine, but naturally can't permanently save any imported podcasts. The log prints several ❌ - database is locked errors, but this doesn't appear fatal.

/var/Podfetch/ is owned by 1000:1000, with permissions set to 775.

One thing that podman does differently which might be relevant is using pasta, replicating the hosts IP in the container. I know that the image provided is explicitly a docker image with no implied support for podman, and that this might be a podman issue, so please do close it if it's inappropriate.

Reproduction

podman run -d --name podfetch --user 1000:1000 -p 80:8000 -v /var/Podfetch/db:/app/db -v /var/Podfetch/podcasts:/app/podcasts -e POLLING_INTERVAL=60 -e SERVER_URL=http://localhost:80 -e DATABASE_URL=sqlite:///app/db/podcast.db samuel19982/podfetch:latest

System Info

podman info --debug
host:
  arch: amd64
  buildahVersion: 1.38.0
  cgroupControllers:
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.12-1.1.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: unknown'
  cpuUtilization:
    idlePercent: 99.79
    systemPercent: 0.08
    userPercent: 0.12
  cpus: 12
  databaseBackend: sqlite
  distribution:
    distribution: opensuse-microos
    version: "20241224"
  eventLogger: journald
  freeLocks: 2041
  hostname: apollo
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.12.6-1-default
  linkmode: dynamic
  logDriver: journald
  memFree: 183013376
  memTotal: 16231383040
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.13.1-1.1.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.13.1
    package: netavark-1.13.1-1.1.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.13.1
  ociRuntime:
    name: crun
    package: crun-1.19-1.1.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.19
      commit: db31c42ac46e20b5527f5339dcbf6f023fcd539c
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-20241211.09478d5-1.1.x86_64
    version: |
      pasta 20241211.09478d5-1.1
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 0
  swapTotal: 0
  uptime: 32h 14m 59.00s (Approximately 1.33 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.opensuse.org
  - registry.suse.com
  - docker.io
store:
  configFile: /home/host/.config/containers/storage.conf
  containerStore:
    number: 3
    paused: 0
    running: 2
    stopped: 1
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/host/.local/share/containers/storage
  graphRootAllocated: 21474836480
  graphRootUsed: 5493506048
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 3
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/host/.local/share/containers/storage/volumes
version:
  APIVersion: 5.3.1
  Built: 1733485830
  BuiltTime: Fri Dec  6 11:50:30 2024
  GitCommit: ""
  GoVersion: go1.23.4
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.1

Used Package Manager

n/a

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@SamTV12345
Copy link
Owner

Hi. It is quite weird because if you use no DATABASE_URL it should use SQLite. You then miss the mapping for the database volume. If you add that it should work. So docker run -d --name podfetch --user 0:0 -p 80:8000 -e POLLING_INTERVAL=60 -e SERVER_URL=http://localhost:80 -e DATABASE_URL=sqlite:///app/db/podcast.db samuel19982/podfetch:latest works without a volume mapping but with user 1000 not.

@SamTV12345
Copy link
Owner

image

This shows when I run your command. For me it says invalid connection with sqlite instead of postgres. After adding the user and changing the permissions it works

@plb-42
Copy link
Author

plb-42 commented Dec 29, 2024

The log showing postgres instead of sqlite was my mistake, I tried out both options to see whether it'd make a difference, and pasted the wrong log.

I just tried it again, using:

podman run -d \
  --name podfetch \
  --user 1000:1000 \
  -p 3000:8000 \
  -v /var/Podfetch/db:/app/db \
  -v /var/Podfetch/podcasts:/app/podcasts \
  -e POLLING_INTERVAL=60 \
  -e SERVER_URL=http://localhost:3000 \
  samuel19982/podfetch:latest

I used port 3000 because port 80 is in the range of restricted ports. I had removes this restriction earlier for testing, but would prefer running podfetch on a higher port anyway.
This results in:

Debug file located at /home/rust/src/target/x86_64-unknown-linux-musl/release/build/podfetch-2ea4860fb8f89ab4/out/built.rs

  ____           _ _____    _       _
 |  _ \ ___   __| |  ___|__| |_ ___| |__
 | |_) / _ \ / _` | |_ / _ \ __/ __| '_ \
 |  __/ (_) | (_| |  _|  __/ || (__| | | |
 |_|   \___/ \__,_|_|  \___|\__\___|_| |_|

        


2024-12-29T23:16:10 ℹ️ - Starting with the following environment variables:
2024-12-29T23:16:10 ℹ️ - Public server url: http://localhost:3000/
2024-12-29T23:16:10 ℹ️ - Polling interval for new episodes: 60 minutes
2024-12-29T23:16:10 ℹ️ - Developer specifications available at http://localhost:3000/swagger-ui/index.html#/


2024-12-29T23:16:10 ℹ️ - GPodder integration enabled: false
2024-12-29T23:16:10 ℹ️ - Podindex API key&secret configured: false
2024-12-29T23:16:10 ❌ - Error connecting to sqlite://./db/podcast.db with reason Invalid connection url for multiconnection

User 1000:1000 is "host". Output for ls -ld /var/Podfetch/podcasts/ is drwxrwxr-x. 1 host host 0 Dec 26 14:46 /var/Podfetch/podcasts/, and for ls -ld /var/Podfetch/db it's drwxrwxr-x. 1 host host 0 Dec 26 14:46 /var/Podfetch/db.

I probably missed something at some point in the process, but I'm not entirely sure what it might be.

@SamTV12345
Copy link
Owner

The log showing postgres instead of sqlite was my mistake, I tried out both options to see whether it'd make a difference, and pasted the wrong log.

I just tried it again, using:

podman run -d \
  --name podfetch \
  --user 1000:1000 \
  -p 3000:8000 \
  -v /var/Podfetch/db:/app/db \
  -v /var/Podfetch/podcasts:/app/podcasts \
  -e POLLING_INTERVAL=60 \
  -e SERVER_URL=http://localhost:3000 \
  samuel19982/podfetch:latest

I used port 3000 because port 80 is in the range of restricted ports. I had removes this restriction earlier for testing, but would prefer running podfetch on a higher port anyway. This results in:

Debug file located at /home/rust/src/target/x86_64-unknown-linux-musl/release/build/podfetch-2ea4860fb8f89ab4/out/built.rs

  ____           _ _____    _       _
 |  _ \ ___   __| |  ___|__| |_ ___| |__
 | |_) / _ \ / _` | |_ / _ \ __/ __| '_ \
 |  __/ (_) | (_| |  _|  __/ || (__| | | |
 |_|   \___/ \__,_|_|  \___|\__\___|_| |_|

        


2024-12-29T23:16:10 ℹ️ - Starting with the following environment variables:
2024-12-29T23:16:10 ℹ️ - Public server url: http://localhost:3000/
2024-12-29T23:16:10 ℹ️ - Polling interval for new episodes: 60 minutes
2024-12-29T23:16:10 ℹ️ - Developer specifications available at http://localhost:3000/swagger-ui/index.html#/


2024-12-29T23:16:10 ℹ️ - GPodder integration enabled: false
2024-12-29T23:16:10 ℹ️ - Podindex API key&secret configured: false
2024-12-29T23:16:10 ❌ - Error connecting to sqlite://./db/podcast.db with reason Invalid connection url for multiconnection

User 1000:1000 is "host". Output for ls -ld /var/Podfetch/podcasts/ is drwxrwxr-x. 1 host host 0 Dec 26 14:46 /var/Podfetch/podcasts/, and for ls -ld /var/Podfetch/db it's drwxrwxr-x. 1 host host 0 Dec 26 14:46 /var/Podfetch/db.

I probably missed something at some point in the process, but I'm not entirely sure what it might be.

I just tried your scenario. Freshly setup podman with https://community-scripts.github.io/ProxmoxVE/scripts?id=podman in Proxmox VE.

groupadd -g 1000 podfetcher
useradd -u 1000 -g 1000 podfetch
chown -R podfetch /var/Podfetch/db
podman run -d   --name podfetch   --user 1000:1000   -p 3000:8000   -v /var/Podfetch/db:/app/db   -v /var/Podfetch/podcasts:/app/podcasts   -e POLLING_INTERVAL=60   -e SERVER_URL=http://localhost:3000   samuel19982/podfetch:latest

Let me know if this fixed your problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants