Skip to content

Commit

Permalink
Support Podman (#197)
Browse files Browse the repository at this point in the history
* Specify a concrete port in conftest.py
* add docker.io/ prefix to DEFAULT_IMAGE
  • Loading branch information
danielhollas authored Feb 6, 2024
1 parent 57820bc commit 3d7c9d2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
default-image:
- '' # use the application default
- aiidalab/aiidalab-docker-stack:latest
- aiidalab/aiidalab-docker-stack:latest # This is the old stack

steps:

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AiiDAlab Launch makes it easy to run AiiDAlab on your own workstation or laptop.

To use AiiDAlab launch you will have to

1. [Install Docker on your workstation or laptop.](https://docs.docker.com/get-docker/)
1. [Install Docker on your workstation or laptop.](https://docs.docker.com/get-docker/) (you can also use Podman, [see below](README.md#using-podman))
2. Install AiiDAlab launch with [pipx](https://pypa.github.io/pipx/installation/) (**recommended**):

```console
Expand Down Expand Up @@ -70,6 +70,17 @@ Please see [here](ssh-forward.md) for instructions on how to run AiiDAlab on a r

This package follows the Python compatibility and deprecation schedule specified by [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html).

### Using Podman instead of Docker

You should be able to use Podman as as a drop-in replacement for Docker, with just a little extra setup. The following was tested on Fedora 39 which comes with Podman pre-installed.

```console
systemctl --user enable podman.socket
systemctl --user start podman.socket
systemctl --user status podman.socket
export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
```

## Development

### Setting up a development environment
Expand Down Expand Up @@ -162,7 +173,7 @@ SOFTWARE.
## Acknowledgements

This work is supported by the
[MARVEL National Centre for Competency in Research](<http://nccr-marvel.ch>) funded by the [Swiss National Science Foundation](<http://www.snf.ch/en>),
[MARVEL National Centre for Competency in Research](<https://nccr-marvel.ch>) funded by the [Swiss National Science Foundation](<https://www.snf.ch/en>),
the MARKETPLACE project funded by [Horizon 2020](https://ec.europa.eu/programmes/horizon2020/) under the H2020-NMBP-25-2017 call (Grant No. 760173),
as well as by the [MaX
European Centre of Excellence](<http://www.max-centre.eu/>) funded by the Horizon 2020 EINFRA-5 program,
Expand Down
17 changes: 11 additions & 6 deletions aiidalab_launch/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def _default_port() -> int: # explicit function required to enable test patchin
return DEFAULT_PORT


DEFAULT_IMAGE = "aiidalab/full-stack:latest"
DEFAULT_REGISTRY = "docker.io"
DEFAULT_IMAGE_PATH = "aiidalab/full-stack:latest"
DEFAULT_IMAGE = f"{DEFAULT_REGISTRY}/{DEFAULT_IMAGE_PATH}"


def _valid_volume_name(source: str) -> None:
Expand Down Expand Up @@ -158,11 +160,14 @@ def from_container(cls, container: Container) -> Profile:

system_user = get_docker_env(container, "SYSTEM_USER")

image_tag = (
DEFAULT_IMAGE
if DEFAULT_IMAGE in container.image.tags
else container.image.tags[0]
)
if DEFAULT_IMAGE in container.image.tags:
image_tag = DEFAULT_IMAGE
# Docker seems to strip `docker.io` from the image name
# so we add it back manually.
elif DEFAULT_IMAGE_PATH in container.image.tags:
image_tag = f"{DEFAULT_REGISTRY}/{DEFAULT_IMAGE_PATH}"
else:
image_tag = container.image.tags[0]

extra_destinations: list[PurePosixPath] = [
PurePosixPath(mount["Destination"])
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _pull_docker_image(docker_client):
# Avoid interfering with used ports on the host system.
@pytest.fixture(scope="session", autouse=True)
def _default_port(monkeypatch_session):
monkeypatch_session.setattr(aiidalab_launch.profile, "DEFAULT_PORT", None)
monkeypatch_session.setattr(aiidalab_launch.profile, "DEFAULT_PORT", 7777)
yield None


Expand Down

0 comments on commit 3d7c9d2

Please sign in to comment.