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

Podman compatibility #7

Closed
Lunarequest opened this issue Dec 27, 2020 · 14 comments · Fixed by #8
Closed

Podman compatibility #7

Lunarequest opened this issue Dec 27, 2020 · 14 comments · Fixed by #8
Assignees
Labels
enhancement New feature or request

Comments

@Lunarequest
Copy link

Lunarequest commented Dec 27, 2020

Is this project compatible with podman rootless docker? It would be a lot safer for aur maintenaners if this could use podman

@Lunarequest Lunarequest changed the title Podman compatible Podman compatibility Dec 27, 2020
@bionade24 bionade24 self-assigned this Dec 27, 2020
@bionade24 bionade24 added the enhancement New feature or request label Dec 27, 2020
@bionade24
Copy link
Owner

Is this project compatible with podman rootless docker? It would be a lot safer for aur maintenaners if this could use podman

Can someone with podman experience please answer if docker and podman are mostly a API-compliant? Would it be sufficent to make the name of the socket in abs_cd/makepkg/makepkg.py changable? vOr is more needed than podman.sock?

@bionade24 bionade24 added this to To do in Planned things Dec 27, 2020
@Lunarequest
Copy link
Author

Lunarequest commented Dec 27, 2020

podman has a rest api that is compatible with docker. you can read more about it here. However it also has a large amount of podman specific endpoints which are more powerful

@bionade24
Copy link
Owner

Could you please test it? I made a PR, which worked for me.

@bionade24 bionade24 moved this from To do to In progress in Planned things Dec 27, 2020
@Lunarequest
Copy link
Author

I'll test it out now

@Lunarequest
Copy link
Author

Lunarequest commented Dec 28, 2020

could you explain how to set it up with podman. It just isn't working for me

@bionade24
Copy link
Owner

bionade24 commented Dec 28, 2020

systemctl enable podman.socket --now

Please test two cases:

  1. Only change the docker-compose.yml: Change /var/run/docker.sock only on host-side to /var/run/podman/podman.sock, but let the container path still be docker.sock
  2. Change the path in the docker-compose.yml entirely, so that host and container path are both podman-like and then adjust the socket URL probably under /var/local/abs_cd/data/setttings.ini, if you haven't changed it, to the podman path. Then restart the abs_cd container.

You have to be on the podman branch for the latter one.

@Lunarequest
Copy link
Author

I keep getting the following error from podman-compose

podman volume inspect abs_cd_local-repo || podman volume create abs_cd_local-repo
Traceback (most recent call last):
  File "/usr/bin/podman-compose", line 33, in <module>
    sys.exit(load_entry_point('podman-compose==0.1.5', 'console_scripts', 'podman-compose')())
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 1093, in main
    podman_compose.run()
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 625, in run
    cmd(self, args)
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 782, in wrapped
    return func(*args, **kw)
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 897, in compose_up
    podman_args = container_to_args(compose, cnt,
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 457, in container_to_args
    mount_args = mount_desc_to_args(compose, volume, cnt['_service'], cnt['name'])
  File "/usr/lib/python3.9/site-packages/podman_compose.py", line 386, 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.9/site-packages/podman_compose.py", line 366, in mount_dict_vol_to_bind
    src = json.loads(out)[0]["mountPoint"]
KeyError: 'mountPoint'

@bionade24
Copy link
Owner

That's because doesn't support standalone volumes. containers/podman-compose#13
You can easily circumvent this by only mounting paths.

I now tested this on podman, changed a bit more and got some network issue:

>>> p.rebuildtree()
Connection already established
Generating new image abs-cd/makepkg, please wait
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/docker/api/client.py", line 259, in _raise_for_status
    response.raise_for_status()
  File "/usr/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.40/containers/1a8fc96ca980c23e3e8c1d3a22ab55b8366f123a8ea0a9d8d53abc5b3aa72fe9/start

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/opt/abs_cd/cd_manager/models.py", line 106, in rebuildtree
    self.build(force_rebuild=True, built_packages=built_packages)
  File "/opt/abs_cd/cd_manager/models.py", line 102, in build
    self.run_cd()
  File "/opt/abs_cd/cd_manager/models.py", line 58, in run_cd
    PackageSystem().build(self)
  File "/opt/abs_cd/makepkg/makepkg.py", line 55, in build
    output = PackageSystem._docker_conn.containers.run(image='abs-cd/makepkg', remove=True,
  File "/usr/lib/python3.9/site-packages/docker/models/containers.py", line 816, in run
    container.start()
  File "/usr/lib/python3.9/site-packages/docker/models/containers.py", line 404, in start
    return self.client.api.start(self.id, **kwargs)
  File "/usr/lib/python3.9/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/docker/api/container.py", line 1108, in start
    self._raise_for_status(res)
  File "/usr/lib/python3.9/site-packages/docker/api/client.py", line 261, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/lib/python3.9/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("error configuring network namespace for container 1a8fc96ca980c23e3e8c1d3a22ab55b8366f123a8ea0a9d8d53abc5b3aa72fe9: CNI network "default" not found")

Would be nice if someone with more podman experience could help me please, podman feels very alpha overall not like a 2.0 program.

@Lunarequest
Copy link
Author

Lunarequest commented Jan 1, 2021

after installing the devel version of podman-compose I now get a permissions error as a unprivileged user should not be able to access /var/run or /srv/ however the api can run as a user service which is in $XDG_RUNTIME_DIR/podman/podman.sock . The issue now is volumes can not have / in them

@Lunarequest
Copy link
Author

Lunarequest commented Jan 1, 2021

changing the paths too local ones in the compose file and using $XDG_RUNTIME_DIR/podman/podman.sock instead of /var/run it works! this is my compose file.

version: '3.4'

services:
  abs_cd:
    image: abs_cd
    build:
      context: .
      dockerfile: Dockerfile
    restart: on-failure:3
    ports:
      - '8000:8000'
    volumes:
      - '/run/user/1000/podman/podman.sock:/var/run/docker.sock'
      - 'data:/opt/abs_cd/data'
      - 'srv:/opt/abs_cd/staticfiles'
      - 'local-repo:/repo'
      - 'packages:/var/packages'
volumes:
  local-repo:

@bionade24
Copy link
Owner

So building worked for you, too?

@Lunarequest
Copy link
Author

sorry I took so long to respond I have been traveling. Yes building worked

@bionade24
Copy link
Owner

Nice! then I'll put your docker-compose.yml in a gist and link it in the podman section. Thx!.

@Lunarequest
Copy link
Author

no problem

@bionade24 bionade24 moved this from In progress to Done in Planned things Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants