containers / podman-compose

a script to run docker-compose.yml using podman
GNU General Public License v2.0
5.07k stars 485 forks source link

Volumes under /var/home instead of /home #103

Closed yajo closed 4 years ago

yajo commented 4 years ago

I don't know why, but podman is trying to create volumes under /var/home instead of under /home. Obviously it fails with permission problems:

➤ podman-compose run --rm odoo bash
podman pod create --name=doodba-devel-13.0 --share net -p 127.0.0.1:1984:1984 -p 127.0.0.1:8025:8025 -p 127.0.0.1:6899:6899 -p 127.0.0.1:13069:8069
Error: could not get runtime: error creating runtime static files directory /var/home/yajo/.local/share/containers/storage/libpod: mkdir /var/home: permission denied
125
Namespace(T=False, cnt_command=['bash'], command='run', detach=False, dry_run=False, e=None, entrypoint=None, file=['docker-compose.yml'], label=None, name=None, no_ansi=False, no_cleanup=False, no_deps=False, podman_path='podman', project_name=None, publish=None, rm=True, service='odoo', service_ports=False, transform_policy='1podfw', user=None, volume=None, workdir=None)
podman volume inspect doodba-devel-13.0_filestore || podman volume create doodba-devel-13.0_filestore
Error: could not get runtime: error creating runtime static files directory /var/home/yajo/.local/share/containers/storage/libpod: mkdir /var/home: permission denied
Error: could not get runtime: error creating runtime static files directory /var/home/yajo/.local/share/containers/storage/libpod: mkdir /var/home: permission denied
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 379, in mount_dict_vol_to_bind
    try: out = compose.podman.output(["volume", "inspect", vol_name]).decode('utf-8')
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 630, in output
    return subprocess.check_output(cmd)
  File "/usr/lib64/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['podman', 'volume', 'inspect', 'doodba-devel-13.0_filestore']' returned non-zero exit status 125.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/podman-compose", line 11, in <module>
    load_entry_point('podman-compose==0.1.6.dev0', 'console_scripts', 'podman-compose')()
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 1267, in main
    podman_compose.run()
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 755, in run
    cmd(self, args)
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 939, in wrapped
    return func(*args, **kw)
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 1125, in compose_run
    podman_args = container_to_args(compose, cnt, args.detach)
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 481, in container_to_args
    mount_args = mount_desc_to_args(compose, volume, cnt['_service'], cnt['name'])
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 408, in mount_desc_to_args
    mount_desc = mount_dict_vol_to_bind(compose, fix_mount_dict(mount_desc, proj_name, srv_name))
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 381, in mount_dict_vol_to_bind
    compose.podman.output(["volume", "create", "--label", "io.podman.compose.project={}".format(proj_name), vol_name])
  File "/usr/lib/python3.7/site-packages/podman_compose.py", line 630, in output
    return subprocess.check_output(cmd)
  File "/usr/lib64/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['podman', 'volume', 'create', '--label', 'io.podman.compose.project=doodba-devel-13.0', 'doodba-devel-13.0_filestore']' returned non-zero exit status 125.
`docker-compose.yml` file ```yaml networks: default: internal: true public: {} services: cdnjs_cloudflare_proxy: environment: PRE_RESOLVE: 1 TARGET: cdnjs.cloudflare.com image: tecnativa/whitelist networks: default: aliases: - cdnjs.cloudflare.com public: null db: environment: CONF_EXTRA: 'work_mem = 32MB ' POSTGRES_DB: devel POSTGRES_PASSWORD: odoopassword POSTGRES_USER: odoo image: tecnativa/postgres-autoconf:10-alpine shm_size: 512mb volumes: - db:/var/lib/postgresql/data:z fonts_googleapis_proxy: environment: PRE_RESOLVE: 1 TARGET: fonts.googleapis.com image: tecnativa/whitelist networks: default: aliases: - fonts.googleapis.com public: null fonts_gstatic_proxy: environment: PRE_RESOLVE: 1 TARGET: fonts.gstatic.com image: tecnativa/whitelist networks: default: aliases: - fonts.gstatic.com public: null google_proxy: environment: PRE_RESOLVE: 1 TARGET: www.google.com image: tecnativa/whitelist networks: default: aliases: - www.google.com public: null gravatar_proxy: environment: PRE_RESOLVE: 1 TARGET: www.gravatar.com image: tecnativa/whitelist networks: default: aliases: - www.gravatar.com public: null odoo: build: args: AGGREGATE: "false" CLEAN: "false" COMPILE: "false" GID: '1000' ODOO_VERSION: '13.0' PIP_INSTALL_ODOO: "false" UID: '1000' context: /home/yajo/Documentos/prodevel/doodba-devel-13.0/odoo command: - odoo - --limit-memory-soft=0 - --limit-time-real-cron=9999999 - --limit-time-real=9999999 - --workers=0 - --dev=reload,qweb,werkzeug,xml depends_on: cdnjs_cloudflare_proxy: condition: service_started db: condition: service_started fonts_googleapis_proxy: condition: service_started fonts_gstatic_proxy: condition: service_started google_proxy: condition: service_started gravatar_proxy: condition: service_started smtp: condition: service_started wdb: condition: service_started environment: DB_FILTER: .* DOODBA_ENVIRONMENT: devel EMAIL_FROM: '' LIST_DB: "true" PGDATABASE: devel PGUSER: odoo PROXY_MODE: "true" PTVSD_ENABLE: '0' PYTHONOPTIMIZE: '' PYTHONPATH: /opt/odoo/custom/src/odoo SMTP_PORT: '1025' WITHOUT_DEMO: "false" hostname: example.com image: docker.io/myuser/myproject-odoo:13.0 labels: traefik.docker.network: inverseproxy_shared traefik.enable: "true" traefik.frontend.passHostHeader: "true" traefik.longpolling.port: '8072' traefik.port: '8069' tty: true volumes: - /home/yajo/Documentos/prodevel/doodba-devel-13.0/odoo/auto/addons:/opt/odoo/auto/addons:rw,z - /home/yajo/Documentos/prodevel/doodba-devel-13.0/odoo/custom:/opt/odoo/custom:ro,z - filestore:/var/lib/odoo:z odoo_proxy: depends_on: odoo: condition: service_started environment: PORT: 6899 8069 TARGET: odoo image: tecnativa/whitelist networks: default: null public: null ports: - 127.0.0.1:6899:6899/tcp - 127.0.0.1:13069:8069/tcp smtp: image: mailhog/mailhog networks: default: {} public: {} ports: - 127.0.0.1:8025:8025/tcp wdb: image: kozea/wdb networks: default: null public: null ports: - 127.0.0.1:1984:1984/tcp stop_signal: KILL version: '2.4' volumes: db: {} filestore: {} ```
dimon222 commented 4 years ago

Check the path to volume directory in ~/.config/containers/libpod.conf

Variable "volume_path" can be adjusted. If it doesn't match, its possible that there was system configuration change AFTER installation of podman itself. Also, its related to libpod itself, not the podman-compose.

yajo commented 4 years ago

It must have been some garbage from a previous silverblue installation.

Fixed with rm -Rf ~/.local/share/containers ~/.config/containers, thanks.