aboutcode-org / purldb

Tools to create and expose a database of purls (Package URLs). This project is sponsored by NLnet project https://nlnet.nl/project/vulnerabilitydatabase/ and nexB for https://www.aboutcode.org/ Chat is at https://gitter.im/aboutcode-org/discuss
https://purldb.readthedocs.io/
35 stars 23 forks source link

Also support (and test) deployment using podman #438

Open pombredanne opened 6 months ago

pombredanne commented 6 months ago

We should also support (and test) deployment using podman and other container runners, beyond docker.

JonoYang commented 6 months ago

These are the steps I have taken to install podman on a fresh install of debian testing:

  1. Install podman, podman-compose, and podman-docker

    • sudo apt-get install podman podman-compose podman-docker

    This will also install docker-compose

  2. Create and start podman user service for rootless podman

    • systemctl --user enable podman --now

    This sets up a podman socket that is accessible by the user without using root.

  3. Add the following lines to /etc/sysctl.conf

    • net.ipv4.ip_unprivileged_port_start=80
      • This is to allow rootless containers to use ports 80 and above. By default, rootless containers cannot use ports lower than 1024.
    • vm.overcommit_memory=1
      • Redis displays a warning message that says to add this to /etc/sysctl.conf when the container is launched.
  4. Add the following lines to /etc/containers/registries.conf

    • unqualified-search-registries = ["docker.io"]

    This adds docker.io as a source to pull images from.

  5. You may have to set DOCKER_HOST environment variable for some tools

    • unix:///var/run/user/1000/podman/podman.sock

    This assumes that there is only one user on the system.

JonoYang commented 6 months ago

I get this error when I try to run docker compose up after running docker compose build:

$ docker compose up
>>>> Executing external compose provider "/usr/bin/docker-compose". Please refer to the documentation for details. <<<<

ERROR: The Compose file './docker-compose.yml' is invalid because:
'include' does not match any of the regexes: '^x-'

You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
Error: executing /usr/bin/docker-compose up: exit status 1

The old docker-compose Python script is being used, which does not support the newer Compose file specs.

JonoYang commented 6 months ago

Installing the latest version of podman-compose from GitHub with pip install https://github.com/containers/podman-compose/archive/refs/tags/v1.1.0.tar.gz resolves this issue.