docker for windows 使用swoole并推送到docker hub仓库

本地拉取镜像:

docker pull phpswoole/swoole:4.5.9-php7.4

测试镜像环境:

docker run --rm phpswoole/swoole:4.5.9-php7.4 "php -m"
docker run --rm phpswoole/swoole:4.5.9-php7.4 "php --ri swoole"
docker run --rm phpswoole/swoole:4.5.9-php7.4 "composer --version"

服务代码 D:\docker\swoole\server.php

on('Request', function ($request, $response) {
    $response->header('Content-Type', 'text/html; charset=utf-8');
    $response->end('

Hello Swoole. #' . rand(1000, 9999) . '

'); }); $http->start();

启动容器

docker run --rm -p 8000:9501 --name swoole -v D:\docker\swoole:/var/www phpswoole/swoole:4.5.9-php7.4

浏览器查看localhost:8000

image.png

查看所有容器

docker ps -a
image.png

进入容器

docker exec -it [CONTAINER ID] bash
image.png

运行服务代码

php server.php

本地镜像phpswoole/swoole:4.5.9-php7.4标签到个人线上仓库18061808047/swoole的default标签

docker tag phpswoole/swoole:4.5.9-php7.4 18061808047/swoole:default
image.png

本地镜像推送到线上

docker push 18061808047/swoole:default
image.png

docker hub仓库:


image.png

你可能感兴趣的:(docker for windows 使用swoole并推送到docker hub仓库)