iT邦幫忙

2021 iThome 鐵人賽

DAY 4
0
自我挑戰組

Laravel 虛無飄渺系列 第 4

Day04 - Docker 簡單指令操作

  • 分享至 

  • xImage
  •  

查看服務,進入Container

查看docker啟用哪些service

$ docker-compose ps

NAME                        COMMAND                  SERVICE             STATUS              PORTS
docker_docker-in-docker_1   "dockerd-entrypoint.…"   docker-in-docker    running             2375/tcp, 2376/tcp
docker_mysql_1              "docker-entrypoint.s…"   mysql               running             0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp
docker_nginx_1              "/docker-entrypoint.…"   nginx               running             0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:81->81/tcp, :::81->81/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp
docker_php-fpm_1            "docker-php-entrypoi…"   php-fpm             running             9000/tcp, 0.0.0.0:9003->9003/tcp, :::9003->9003/tcp
docker_phpmyadmin_1         "/docker-entrypoint.…"   phpmyadmin          running             0.0.0.0:8081->80/tcp, :::8081->80/tcp
docker_redis_1              "docker-entrypoint.s…"   redis               running             0.0.0.0:6379->6379/tcp, :::6379->6379/tcp
docker_workspace_1          "/sbin/my_init"          workspace           running             0.0.0.0:2222->22/tcp, :::2222->22/tcp, 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp, 0.0.0.0:3001->3001/tcp, :::3001->3001/tcp, 0.0.0.0:4200->4200/tcp, :::4200->4200/tcp, 0.0.0.0:8001->8000/tcp, :::8001->8000/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp

進入 Workspace 容器,執行(Artisan、Composer、PHPUnit、Gulp 等)命令

$ docker-compose exec workspace bash

或者,對於 Windows PowerShell 用戶:執行以下命令以進入任何正在運行的容器:
查看docker啟用哪些service

docker ps

CONTAINER ID   IMAGE          COMMAND                  CREATED      STATUS      PORTS                                                                                                                                                                                                                                   NAMES
e2e2fc231c97   fd2023af705e   "docker-php-entrypoi…"   4 days ago   Up 3 days   9000/tcp, 0.0.0.0:9013->9003/tcp, :::9013->9003/tcp                                                                                                                                                                                     docker_php-fpm-80_1
298fc5384bd7   34d5688329b6   "/sbin/my_init"          4 days ago   Up 3 days   0.0.0.0:3000-3001->3000-3001/tcp, :::3000-3001->3000-3001/tcp, 0.0.0.0:4200->4200/tcp, :::4200->4200/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:2222->22/tcp, :::2222->22/tcp, 0.0.0.0:8001->8000/tcp, :::8001->8000/tcp   docker_workspace_1
595a990bf2b0   fa3b7a5678ec   "dockerd-entrypoint.…"   4 days ago   Up 3 days   2375-2376/tcp                                                                                                                                                                                                                           docker_docker-in-docker_1
e4021293f48c   32fbae9a98c9   "/docker-entrypoint.…"   5 days ago   Up 3 days   0.0.0.0:80-81->80-81/tcp, :::80-81->80-81/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp                                                                                                                                                    docker_nginx_1
cdcf4c2838e6   510588d0f193   "docker-php-entrypoi…"   5 days ago   Up 3 days   9000/tcp, 0.0.0.0:9003->9003/tcp, :::9003->9003/tcp                                                                                                                                                                                     docker_php-fpm_1
fe3d136a8351   73a81f7cb030   "/docker-entrypoint.…"   5 days ago   Up 3 days   0.0.0.0:8081->80/tcp, :::8081->80/tcp                                                                                                                                                                                                   docker_phpmyadmin_1
b65b1a6e0d2f   f2ef00f31fdf   "docker-entrypoint.s…"   5 days ago   Up 3 days   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                                                                                                                                                               docker_redis_1
7d49d155eaf2   4f12c302b3fb   "docker-entrypoint.s…"   5 days ago   Up 3 days   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp                                                                                                                                                                                    docker_mysql_1
docker exec -it {workspace-container-id} bash

進入 workspace 範例:

docker-compose exec workspace bash
root@298fc5384bd7:/var/www# 

離開Container*

docker-compose exec workspace bash
root@298fc5384bd7:/var/www# exit

上一篇
Day03 - 安裝 Laradock 環境建置
下一篇
Day05 - Nginx 設定
系列文
Laravel 虛無飄渺5
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言