如果服务器运行到容器中,则可以从 Host 运行“php artisan commands”,以及如何运行?
您需要更改路径引用以适合您自己的项目,但这允许您从容器上的主机执行 artisan 命令,而无需登录。
docker exec -it <php-fpm-container> /var/www/html/artisan
To run commands from your host,
You can use Docker's exec
command like this:
docker exec -it my-container-name /bin/bash
After that, you can run any command you want
php artisan --version
Client ( php artisan
) on the host talking to server in a container is a solved problem:
This can be done in two ways. They make the server's port in the container accessible on the host:
if using docker-compose
docker-compose exec <container_name|id> bash
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.