Docker images
Docker images are executable packages for running containers. Images are distributed via a Docker registry. By default, PhpStorm uses Docker Hub, which is a public registry with all of the most common images, such as various Linux flavors, database management systems, web servers, and runtime environments. There are other public and private Docker registries, and you can also deploy your own registry server. For more information, see Configure a Docker registry.
Enable the Docker plugin
This functionality relies on the Docker plugin, which is bundled and enabled in PhpStorm by default. If the relevant features aren't available, make sure that you didn't disable the plugin.
Press Ctrl+Alt+S to open the IDE settings and select
.Open the Installed tab, find the Docker plugin, and select the checkbox next to the plugin name.
To manage Docker images in PhpStorm, open the Services tool window ( or Alt+8), expand the configured Docker connection node , and then expand the Images node. For more information, see Images.
Depending on your development needs, you can use Docker for the following:
Build images locally from a Dockerfile
For example, you can build an image that runs a container with a specific version of PHP that your application requires.
Push your images to a Docker registry
For example, if you want to demonstrate to someone how your application runs in some specific version of PHP instead of setting up the proper environment, they can run a container from your image.
Configure a Docker registry
In the Services tool window, click and select Docker Registry.
In the New Docker Registry dialog, specify how to connect to the registry. When you specify the credentials, PhpStorm will automatically check the connection to the registry. The Connection successful message should appear at the bottom of the dialog.
Alternatively, you can manage the list of configured Docker registries in Docker Registry settings.
Pull an image from a Docker registry
In the Services tool window ( or Alt+8), select the Images node.
Under Images Console, type the name of the image to pull. For example:
phpstorm/php-apache:8.0-xdebug3.0
Use completion to select from the available suggestions of official images. Press Ctrl+Space again to see relevant images from all users.
Press Ctrl+Enter to run docker pull.
Specify the image as in the Docker CLI, for example: ubuntu:20.04
.
Build an image from a Dockerfile
When you are editing a Dockerfile, PhpStorm provides completion for images from the configured registries.
Open the Dockerfile from which you want to build the image.
Click in the gutter and select to build the image.
PhpStorm creates a Dockerfile run configuration that runs the docker build command.
Push an image to a Docker registry
In the Services tool window, select the image that you want to upload and click or select Push Image from the context menu.
Select the Docker registry and specify the repository and tag (name and version of the image, for example,
my-app:v2
).Click OK to run the docker push command.
Copy image to another Docker daemon
If you have several Docker daemon connections, you can copy an image from one Docker daemon to another.
In the Services tool window, select the image that you want to copy and click or select Copy Docker Image from the context menu.
In the Copy Docker Image dialog, select the Docker daemon to which you want to copy the image and click Copy.
This first runs the docker save command to save the image from the current Docker daemon as a file, and then the docker load command to load the image from the file on the target Docker daemon.
PhpStorm stores images that you pull or build locally and lists them in the Services tool window under the Images node. When you select an image, you can view its name, ID, date of last changes, size, tags, and any containers using this image, if any. You can also create a new container from the selected image, push the image, or view the layers used by the image. Click to see more actions: copy the image ID to the clipboard, run the docker image inspect command, or show labels applied to the image.
Images with no tags <none>:<none>
can be one of the following:
Intermediate images that serve as layers for other images and do not take up any space.
Dangling images that remain when you rebuild an image based on a newer version of another image. You should regularly prune dangling images to preserve disk space.
To hide untagged images from the list, click on the Docker toolbar, and remove the checkmark from Untagged Images.
To delete one or several images, select them in the list and click .