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

Docker: Unable to set platform of docker container #94

Closed
dankow opened this issue Jan 26, 2023 · 2 comments
Closed

Docker: Unable to set platform of docker container #94

dankow opened this issue Jan 26, 2023 · 2 comments
Labels

Comments

@dankow
Copy link
Contributor

dankow commented Jan 26, 2023

The docker plugin does not support the platform parameter of community.docker.docker_container. This means that we cannot tell molecule to create e.g. a linux/arm64 container on a arm64 system.

dankow added a commit to dankow/molecule-plugins that referenced this issue Jan 26, 2023
Pass `platform` value from `platforms.item` to `docker_container`. Example usage:
```
driver:
  name: docker
platforms:
  - name: test-01
    image: ...
    pre_build_image: true
    platform: linux/amd64
```

As suggested in the [docker_container documentation](https://docs.ansible.com/ansible/latest/collections/community/docker/docker_container_module.html#ansible-collections-community-docker-docker-container-module), ignore the `platform` parameter when comparing state.

Addresses issue ansible-community#94.
@apatard apatard added the docker label Feb 5, 2023
@Maddog2050
Copy link

I'm experiencing a similar issue on my M1 MacBook, where a container that only has an amd64 image causes molecule to fail as it tries to download the arm version of the container which doesn't exist. A workaround that I found was to pull the image for the platform that you want before running molecule.

I made the exact changes as in your PR #95 and was just about to submit it as a PR and then I found this issue and these changes negate the need for the workaround.

ssbarnea added a commit that referenced this issue Apr 5, 2023
* Docker: Add support for `platform` parameter

Pass `platform` value from `platforms.item` to `docker_container`. Example usage:
```
driver:
  name: docker
platforms:
  - name: test-01
    image: ...
    pre_build_image: true
    platform: linux/amd64
```

As suggested in the [docker_container documentation](https://docs.ansible.com/ansible/latest/collections/community/docker/docker_container_module.html#ansible-collections-community-docker-docker-container-module), ignore the `platform` parameter when comparing state.

Addresses issue #94.

* Trigger checks

* Fix ci issue (#111)

* Fix ci issue

* fix ci

* Optimize CI (#112)

Install collection from galaxy, fix typo, do not install ansible via apt-get

* README.md: Update plugin list (#91)

With newly added plugins, the list has to be updated.

Signed-off-by: Arnaud Patard <apatard@hupstream.com>

* Perform linting on Ansible playbooks (#101)

* skip experimental rules

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* Lint ansible files

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* fix missed alignment

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* Fix blk100 flake8 errors

Flake8 is giving errors about some empty lines in the code, so
remove the line to fix these errors.

Signed-off-by: Arnaud Patard <apatard@hupstream.com>

---------

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Signed-off-by: Arnaud Patard <apatard@hupstream.com>
Co-authored-by: Arnaud Patard <apatard@hupstream.com>

* [pre-commit.ci] pre-commit autoupdate (#93)

updates:
- [github.com/psf/black: 22.12.0 → 23.1.0](psf/black@22.12.0...23.1.0)
- [github.com/ansible/ansible-lint.git: v6.10.2 → v6.14.2](https://github.com/ansible/ansible-lint.git/compare/v6.10.2...v6.14.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* install python3 only when ansible_system == Linux (#110)

* assume windows when ansible_connection is winrm

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* replace raw: with package:

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* revert back to raw

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* use uname to check if it's a Linux system

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

---------

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>

* Make selinux an optional extra (#89)

As our special selinux shim dependency also caused problems for
people that did not really need selinux, we now make it a simple
extra.

* Trigger checks

---------

Signed-off-by: Arnaud Patard <apatard@hupstream.com>
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Co-authored-by: Jack <jack4zhang@gmail.com>
Co-authored-by: Arnaud Patard <apatard@hupstream.com>
Co-authored-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
@apatard
Copy link
Member

apatard commented Apr 12, 2023

The PR 95 has been merged so I guess that this PR may be closed.

@apatard apatard closed this as completed Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants