dcoker exports the environment and lays it out online

Start the container locally and mount the local code
docker run --name hyperf -v D:\phpstudy_pro\WWW\hyperf\hyperf-skeleton:/hyperf-skeleton -p 9501:9501 -p 9503:9503 -it --privileged- u root --entrypoint /bin/sh hyperf/hyperf:7.4-alpine-v3.11-swoole
and then export the environment package
docker export -o test.tar hyperf
upload the package to the online server, and then import it to the online docker image
docker import test.tar test
and then upload the local code directory online, or you can synchronize through git, and then start the container
docker run --name hyperf -v /www/wwwroot/hyperf-skeleton:/hyperf-skeleton -p 9501:9501 -p 9503:9503 -it --privileged -u root --entrypoint /bin/sh test
Then start the project and you can access it normally.
Or you want to put the local code directly in the mirror and then transfer it to the server. You can also
create a new folder after you start the container locally, copy the mounted local code to the new folder in the container, and then Export, upload, import, start.

Guess you like

Origin blog.csdn.net/weixin_42094764/article/details/113860822