quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

Quarkus 3.1.0.CR1 can't find a valid Docker env despite valid podman 4.2.0 #33637

Closed ewoks closed 1 month ago

ewoks commented 1 year ago

Describe the bug

When using Podman, Quarkus 3.1.0.CR1 (as well as 3.0.3.Final and older versions) has difficulties to find container engine environment necessary for DevServices (auto activated when no DB url and credentials are provided in application.properties). Alias for docker works, but it isn`t helpful neither.

This is basically the same as [Issue 16541] (https://github.com/quarkusio/quarkus/issues/16541#issuecomment-1564392605), but newly tested and reproduced with Quarkus 3.1.0.CR1, reporting as new per @geoand recommendation.

Expected behavior

When the Podman exists in the $PATH and works without issues on the host OS, mvn quarkus:dev command should be able to use the podman for DevServices (e.g. to start a Postgresql container).

Actual behavior

Error:

Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
    UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause AccessDeniedException (/var/run/docker.sock)As no valid configuration was found, execution cannot continue.
See https://www.testcontainers.org/on_failure.html for more details.

2023-05-26 15:36:13,264 WARN  [io.qua.dep.IsDockerWorking] (build-16) Unix socket defined in DOCKER_HOST unix:///run/user/119066/podman/podman.sock is not writable, make sure Docker is running on the specified host
...
...
Caused by: java.lang.IllegalStateException: Previous attempts to find a Docker environment failed. Will not retry. Please see logs and check configuration
    at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrava:212)

How to Reproduce?

  1. On Linux OS with Podman:
  2. Follow the getting Started reactive guide 1.1. Create new Quarkus project using quarkus-hibernate-reactive-panache, quarkus-reactive-pg-client as well as resteasy reactive extensions, according to the guide 1.2. Add minimal Fruit entity class , in application.properties add quarkus.datasource.db-kind=postgresql, and save, as advised in the guide
  3. execute mvn quarkus:dev from the project root will cause the error from above

Output of uname -a or ver

CSB RHEL: 4.18.0-425.19.2.el8_7.x86_64

Output of java -version

17.0.7-tem

GraalVM version (if different from Java)

~/.sdkman/candidates/java/22.3.0.1.r17-mandrel/

Quarkus version or git rev

3.1.0.CR1

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)

Additional information

Podman 4.2.0 is installed and working without issues on this host. Current workaround as previously described by @vanuatoo

# start podman in another terminal and leave it running with the command
podman system service -t 0

# export the following variables
export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
export TESTCONTAINERS_RYUK_DISABLED=true
# run
mvn quarkus:dev
quarkus-bot[bot] commented 1 year ago

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel)

Karm commented 1 year ago

@gsmet I was preparing a blogpost about Podman for Windows. Then I wanted to test with Podman Desktop and contemporary Quarkus and it doesn't work plus it shows different things in different terminals (suspect color control symbols). It is not just about .exe or the lack thereof.

I will fix it...

krisgerhard commented 1 year ago

Might be related to https://github.com/testcontainers/testcontainers-java/pull/7058. Released yesterday.

ewoks commented 1 year ago

@krisgerhard is there some configuration I could set to take advantage of #7058 ? Additional info I wrote is my current workaround, and it might be a hint why isn't working yet

gsmet commented 1 month ago

I think the Podman story has been greatly improved in the past year. Let's close this one.