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 not supported #1330

Closed
kb-1000 opened this issue Mar 1, 2020 · 27 comments
Closed

Podman not supported #1330

kb-1000 opened this issue Mar 1, 2020 · 27 comments

Comments

@kb-1000
Copy link

kb-1000 commented Mar 1, 2020

Description

Info

  • d-m-p version : 0.28.0
  • Maven version (mvn -v) :
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: /home/kb1000/.m2/wrapper/dists/apache-maven-3.6.2-bin/795eh28tki48bv3l67maojf0ra/apache-maven-3.6.2
Java version: 1.8.0_242, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.fc31.x86_64/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "5.5.6-201.fc31.x86_64", arch: "amd64", family: "unix"
  • Docker version : none, emulated using podman 1.8.0 from Fedora 31
  • If it's a bug, how to reproduce : Install podman on Fedora 31 using sudo dnf install podman-docker and try to use this Maven plugin
  • If it's a feature request, what is your use case :
  • Sample project : https://github.com/quarkusio/quarkus-quickstarts (tested with hibernate-search-elasticsearch-quickstart project there)
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.28.0:stop (docker-start) on project hibernate-search-elasticsearch-quickstart: Execution docker-start of goal io.fabric8:docker-maven-plugin:0.28.0:stop failed: No <dockerHost> given, no DOCKER_HOST environment variable, no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine' and no external provider like Docker machine configured -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[kb1000@local-host hibernate-search-elasticsearch-quickstart]$ docker
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: missing command 'podman COMMAND'
Try 'podman --help' for more information.
@rhuss
Copy link
Collaborator

rhuss commented Mar 2, 2020

True, but that's not a bug. Just a missing feature.

@kb-1000
Copy link
Author

kb-1000 commented Mar 9, 2020

Agreed, but will it get added?

@rhuss
Copy link
Collaborator

rhuss commented Mar 12, 2020

There a no plans yet.

@rhatdan
Copy link

rhatdan commented May 26, 2020

What is needed from Podman to make this work?

@rohanKanojia
Copy link
Member

rohanKanojia commented May 26, 2020

I'm not sure whether it's in DMP's roadmap to add Podman support in the future. But we do have plans to support Podman[0] in Eclipse JKube(next generation of FMP/DMP)[1]

[0] eclipse-jkube/jkube#66
[1] https://github.com/eclipse/jkube

@kb-1000
Copy link
Author

kb-1000 commented May 27, 2020 via email

@rhuss
Copy link
Collaborator

rhuss commented Jun 4, 2020

@rhatdan docker-maven-plugin has two major parts:

  • Building container images by using Docker REST API directly from the the plugin. Abstracting that build part has been started in chore(build): Refactor BuildService and separate Maven/Docker specific parts. #1116 but that work has been stopped end of 2018 due to lack of having enough spare time :). The focus in the meantime has been moved to JKube which formerly relied on this plugin for the build part but since then moved on to add support for more build system (e.g. Jib). I highly would recommend to follow on those projects as it is not likely that dmp will get many more feature if we don't find a new ownership (I plan to retire from the project towards the end of this year, tbh, as I don't have time (nor a mandat) for substantially working on this project). An announcement will follow soon. For the build part, support for Buildah would be the perfect replacementn for Docker.

  • Running containers, especially for Maven driven integration tests. This is where Podman comes into the picture. For the reasons mentioned above and because I think Testcontainers is nowadays a much better option for running containers from within Maven (better community support, more platforms supported ootb, ..), Podman support in docker-maven-plugin is very unlikely (at least from my POV, but course could change if the leadership of docker-maven-plugin would be picked up by someone else). A similar abstraction like a RunService (as implemented for a BuildService in chore(build): Refactor BuildService and separate Maven/Docker specific parts. #1116) would be needed to switch betwewen docker run and podman run.

Said all that, I'm totally open and supportive for PRs would want to tackle and would help to integrate them. But I won't be able to dedicate a considerable amount working effort in dmp.

@kb-1000
Copy link
Author

kb-1000 commented Jun 4, 2020

It's not even necessary to switch between docker run and podman run, the packages (or at least some packages) include a wrapper or a symlink literally called docker. However, if you use the API directly, that obviously won't help.

@rhuss
Copy link
Collaborator

rhuss commented Jun 4, 2020

However, if you use the API directly, that obviously won't help.

That's the point, this plugin does not user the docker cli but talks directory with the Docker daemon via its REST API.

@rhatdan
Copy link

rhatdan commented Jun 4, 2020

Podman 2.0 which is in release candidate stage now supports the REST API of the docker daemon.

@zakkak
Copy link

zakkak commented Jul 13, 2020

FWIW the plugin now seems to work (at least partially) with podman >=2.0.

To make it work as a non-root user do:

podman service -t 3600 & # This will start podman's REST API and keep it alive for 1 hour (3600 seconds)
export DOCKER_HOST="export DOCKER_HOST="unix:/run/user/$(id -u)/podman/podman.sock"
mvn ...

@rhuss
Copy link
Collaborator

rhuss commented Jul 22, 2020

As an idea, we could add support for starting (and stopping) the Podman service transparently, similar like the support we have for docker-machine (see the docs).

@gimbrogno
Copy link

gimbrogno commented Jul 22, 2020

Hi I'm using podman-docker and docker maven plugin v0.31.0 to run docker:build but I have an error from rest api:
[ERROR] DOCKER> Unable to build image []: {"cause":"Content-Type: application/json is not supported. Should be "application/x-tar"","message":"Failed to parse query parameter 'Content-Type': "application/json": Content-Type: application/json is not supported. Should be "application/x-tar"","response":400} (Bad Request: 400)
Any idea to manage docker:build?

@phantomjinx
Copy link

Hi I'm using podman-docker and docker maven plugin v0.31.0 to run docker:build but I have an error from rest api:
[ERROR] DOCKER> Unable to build image []: {"cause":"Content-Type: application/json is not supported. Should be "application/x-tar"","message":"Failed to parse query parameter 'Content-Type': "application/json": Content-Type: application/json is not supported. Should be "application/x-tar"","response":400} (Bad Request: 400)
.....

Encountered same error here while trying out the podman system service -t 3600 workaround. Presumably the podman socket is expected a tar archive whilst the content from the docker-maven-plugin is producing json??

In case it helps, I ran into it while experimenting with replacing docker with podman in syndesis:

  • Configuration
    • docker daemon stopped
    • podman installed and running service as per above
    • calling syndesis cli command -> syndesis build -c -f -m meta --docker (the --docker executes the fabric8-maven-plugin in kubernetes mode)
  • Results

@Danipiario
Copy link

Hi I'm using podman-docker and docker maven plugin v0.31.0 to run docker:build but I have an error from rest api:
[ERROR] DOCKER> Unable to build image []: {"cause":"Content-Type: application/json is not supported. Should be "application/x-tar"","message":"Failed to parse query parameter 'Content-Type': "application/json": Content-Type: application/json is not supported. Should be "application/x-tar"","response":400} (Bad Request: 400)
Any idea to manage docker:build?

Same error for me.
With "podman system service" and DOKER_HOST set

@rhuss
Copy link
Collaborator

rhuss commented Sep 9, 2020

Looks like a mismatch in the content-type when uploading the build context to the daemon. Should be easy to fix (assuming that Docker also works with x-tar as content type). Fancy to do a pull request ?

@wardev
Copy link

wardev commented Sep 10, 2020

I ended up putting nginx between d-m-p and podman to change some of the settings. I was able to successfully build an image and save it to a tar file. I was unable to run it using d-m-p. Below is the Nginx config file I used. The first issue is the content type you already noted. Docker seems to ignore the content type. The second is that podman only seems to include the version header in calls to _ping whereas Docker includes it in every response. This causes d-m-p to be confused about the version. So I had nginx add the adder to all responses.

server {
    listen localhost:8001;
    location /v1.40/build {
        proxy_pass http://localhost:8880/v1.40/build;
        proxy_set_header Content-Type application/x-tar;
    }
    location / {
        proxy_pass http://localhost:8880;
    }
    add_header Api-Version 1.40;
    client_max_body_size 0;
}

@rhuss
Copy link
Collaborator

rhuss commented Sep 14, 2020

I see, thanks for the investigation. Let's tackle Podman support for the next release. At least those two issues should be easy to fix.

@Sanne
Copy link

Sanne commented Jan 6, 2021

Many thanks for this, it's extremely useful!

Updating instructions though, N.B. both preparations commands have to be adjusted slightly now:

 export DOCKER_HOST="unix:/run/user/$(id -u)/podman/podman.sock"
 podman system service -t 3600 &
 mvn ...

(At least, that's what I need to do on Fedora 33 - running as non-root as well. I have both podman and podman-docker installed)

Additionally, some widely used images attempt to perform operations which are typically not allowed under the more restrictive (good) defaults for podman; in many cases it's enough to update the containers, as many have fixed their images.

for example, postgres:10.5 won't work, but postgres:13.1 works flawlessly.

@rhatdan
Copy link

rhatdan commented Jan 6, 2021

Excellent.

@Sanne
Copy link

Sanne commented Jul 2, 2021

Updating here since people seem to have bookmarked this place:

Podman evolved a bit, the better command is now:

podman system service --time=0 unix:/run/user/$(id -u)/podman/podman.sock

@michaelmejaeger
Copy link

Hi, up to now it worked well for me to use the plugin with Podman using podman system service. However, I encountered the following problem today when using docker:push latest (formatted the output for better readability):

DOCKER> Unable to inspect image [sha256:e9685] : 
{
  "cause": "normalizing name for compat API: sha256:e9685: invalid format: no 64-byte hexadecimal value",
  "message": "normalizing image: normalizing name for compat API: sha256:e9685: invalid format: no 64-byte hexadecimal value",
  "response": 500
}

(Internal Server Error: 500)]

The reason seems to be that the plugin uses 5-byte hex shortcuts while the podman-docker-service requires the full 64-byte hex value.

I am using podman in version 4.3.1 together with the latest plugin version 0.40.3.

@rhatdan
Copy link

rhatdan commented Dec 19, 2022

Please open an issue against podman.

@michaelmejaeger
Copy link

Please open an issue against podman.

Done: #1625

@rohanKanojia
Copy link
Member

@michaelmejaeger : I think Daniel meant creating an issue in this repository https://github.com/containers/podman

@michaelmejaeger
Copy link

Ah, sorry, I got that wrong. I will correct that!

@Sanne
Copy link

Sanne commented May 17, 2023

I would suggest closing this - we've been using podman for a while with this maven plugin and it "just works".

There's of course some differences, but that would be out of scope for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests