2023-01-09 14:26:06 +00:00
---
2023-01-10 11:47:06 +00:00
sidebar_position: 2
2023-01-09 14:26:06 +00:00
title: Using the `DOCKER_HOST` environment variable
description: Using the `DOCKER_HOST` environment variable can make it easier to migrate from Docker to Podman Desktop, as it allows you to continue using familiar Docker commands while taking advantage of the benefits of Podman.
keywords: [podman desktop, podman, containers, docker_host, environment, variable]
2023-01-10 11:47:06 +00:00
tags: [migrating-from-docker]
2023-01-09 14:26:06 +00:00
---
2023-01-11 20:18:07 +00:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2023-01-09 14:26:06 +00:00
# Using the `DOCKER_HOST` environment variable
Consider using the `DOCKER_HOST` environment variable to migrate transparently from Docker to Podman Desktop on all platforms.
2023-05-03 10:28:43 +00:00
- Continue using familiar Docker commands.
- Take advantage of the benefits of Podman.
- Your tools, such as [Gradle ](https://gradle.org/ ) or [Testcontainers ](https://www.testcontainers.org/ ), communicate with Podman without reconfiguration.
2023-01-09 14:26:06 +00:00
#### Prerequisites
2023-05-03 10:28:43 +00:00
- Podman
2023-01-09 14:26:06 +00:00
#### Procedure
2023-10-02 13:32:38 +00:00
< Tabs groupId = "operating-systems" >
< TabItem value = "win" label = "Windows" >
2023-01-11 20:18:07 +00:00
2023-10-02 13:32:38 +00:00
1. Identify the location of your Podman pipe
2023-01-09 14:26:06 +00:00
2023-10-02 13:32:38 +00:00
```shell-session
$ podman machine inspect --format '{{.ConnectionInfo.PodmanPipe.Path}}'
```
2023-01-09 14:26:06 +00:00
2023-10-02 13:32:38 +00:00
2. Set the `DOCKER_HOST` environment variable to your Podman pipe location. You'll need to replace back slashes with forward slashes and add the `npipe://` scheme to the path retrieved previously:
2023-01-09 14:26:06 +00:00
2023-10-02 13:32:38 +00:00
```shell-session
$ export DOCKER_HOST=npipe://< your_podman_pipe_location >
```
2023-01-09 14:26:06 +00:00
2023-10-02 15:57:41 +00:00
Note: Setting the `DOCKER_HOST` environment variable isn't necessary on Windows since Podman also listens to the default `docker_engine` pipe.
2023-10-02 13:32:38 +00:00
< / TabItem >
< TabItem value = "mac" label = "macOS" >
2023-01-11 20:18:07 +00:00
2023-10-02 13:32:38 +00:00
1. Identify the location of your Podman socket
2023-01-11 20:18:07 +00:00
2023-10-02 13:32:38 +00:00
```shell-session
$ podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}'
```
2023-01-11 20:18:07 +00:00
2023-08-23 18:48:57 +00:00
2. Set the `DOCKER_HOST` environment variable to your Podman socket location. Be sure to add the `unix://` scheme to the path retrieved previously:
2023-01-09 14:26:06 +00:00
2023-10-02 13:32:38 +00:00
```shell-session
$ export DOCKER_HOST=unix://< your_podman_socket_location >
```
< / TabItem >
< TabItem value = "linux" label = "Linux" >
1. Identify the location of your Podman socket
```shell-session
$ podman info --format '{{.Host.RemoteSocket.Path}}'
```
2. Set the `DOCKER_HOST` environment variable to your Podman socket location. Be sure to add the `unix://` scheme to the path retrieved previously:
```shell-session
$ export DOCKER_HOST=unix://< your_podman_socket_location >
```
< / TabItem >
< / Tabs >
2023-01-09 14:26:06 +00:00
#### Verification
2023-05-03 10:28:43 +00:00
- Your tools using the `DOCKER_HOST` environment variable, such as [Gradle ](https://gradle.org/ ) or [Testcontainers ](https://www.testcontainers.org/ ), communicate with Podman without reconfiguration.