Using the DOCKER_HOST environment variable
Consider using the DOCKER_HOST environment variable to migrate transparently from Docker to Podman Desktop on all platforms.
- Continue using familiar Docker commands.
- Take advantage of the benefits of Podman.
- Your tools, such as Gradle or Testcontainers, communicate with Podman without reconfiguration.
Prerequisites
- Podman
Procedure
- Windows
- macOS
- Linux
- Identify the location of your Podman pipe
$ podman machine inspect --format '{{.ConnectionInfo.PodmanPipe.Path}}'
- Set the
DOCKER_HOSTenvironment variable to your Podman pipe location. You'll need to replace back slashes with forward slashes and add thenpipe://scheme to the path retrieved previously:
$ export DOCKER_HOST=npipe://<your_podman_pipe_location>
Note: Setting the DOCKER_HOST environment variable isn't necessary on Windows since Podman also listens to the default docker_engine pipe.
- Identify the location of your Podman socket
$ podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}'
- Set the
DOCKER_HOSTenvironment variable to your Podman socket location. Be sure to add theunix://scheme to the path retrieved previously:
$ export DOCKER_HOST=unix://<your_podman_socket_location>
- Identify the location of your Podman socket
$ podman info --format '{{.Host.RemoteSocket.Path}}'
- Set the
DOCKER_HOSTenvironment variable to your Podman socket location. Be sure to add theunix://scheme to the path retrieved previously:
$ export DOCKER_HOST=unix://<your_podman_socket_location>
Verification
- Your tools using the
DOCKER_HOSTenvironment variable, such as Gradle or Testcontainers, communicate with Podman without reconfiguration.