Home > Development Tools > phpstorm > How to develop docker with phpstorm under win10

How to develop docker with phpstorm under win10

藏色散人
Release: 2021-08-30 15:22:50
forward
3268 people have browsed it

The following tutorial column of phpstorm will introduce to you through pictures and text the method of developing win10 with phpstorm using docker. I hope it will be helpful to friends in need!

Preface

Today I saw the community's article Windows10 use PHPSTORM and Docker to build Hyperf I have itchy hands for a while, and I want to recall whether the experience of using docker under Windows is better, and record it.

Preparation

Installation

  • Docker Desktop

  • PhpStorm

Installing Docker Desktop will use the wsl function. First install Ubuntu 20.04 LTS, and then install something similar to a plug-in
win10 配合 phpstorm 使用 docker 开发

win10 配合 phpstorm 使用 docker 开发

There is still a problem with starting later, and I have repeatedly uninstalled, restarted, installed, and restarted. solution .

also refers to this. Just follow the above steps to restart the computer and it will be fine. This is not needed.

Alibaba Cloud Image Service

To configure the Alibaba Cloud Image Accelerator, you need to register an account.

Configuring IDE

I don’t know what went wrong. PhpStorm has been unable to connect to docker, but PyCharm can connect to it

win10 配合 phpstorm 使用 docker 开发

win10 配合 phpstorm 使用 docker 开发

I have been struggling with this error for at least two hours. I have installed, uninstalled and restarted various operations. I have adjusted the network card driver several times and it still doesn’t work. I’ll try again next time.

Use PyCharm for subsequent operations.

Create images and containers

First create two empty folders.

D:\docker\mirror
D:\docker\mirror\hyperf

Fill in the following configuration

# hyperf docker 官方镜像版本地址 
https://hub.docker.com/r/hyperf/hyperf/tags

hyperf/hyperf:7.4-alpine-v3.14-swoole

hyperf9501:9501D:\docker\mirror\hyperf:/data/www/hyperf
Copy after login

win10 配合 phpstorm 使用 docker 开发

Start the container and you can see logs, properties, environment variables, ports, mounting directories and other information on the toolbar.

win10 配合 phpstorm 使用 docker 开发

You can also see the started container on Docker Desktop:

win10 配合 phpstorm 使用 docker 开发

Enter the container and set composer first Mirror and then create the project.

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer

composer create-project hyperf/hyperf-skeleton ./ --no-interaction
Copy after login

win10 配合 phpstorm 使用 docker 开发

After successful execution, the file synchronization inside the container can be seen in the folder.

win10 配合 phpstorm 使用 docker 开发

Add the Command item in the docker configuration:

# 目录要跟自己创建的目录一致
php /data/www/hyperf/bin/hyperf.php start
Copy after login

win10 配合 phpstorm 使用 docker 开发

Restart the container and visit http:/ /localhost:9501/

win10 配合 phpstorm 使用 docker 开发

If you are developing, you need to modify the file and restart the container to see the modification.

win10 配合 phpstorm 使用 docker 开发

Postscript

I haven’t touched docker for several years, and it still feels quite difficult to use (manual dog head), and I am still too good at it. .

The above is the detailed content of How to develop docker with phpstorm under win10. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template