Table of contents
View the status of the firewall
Execute phpunit in the container and enter the root directory
common commands
service network restart 重启网卡
docker ps 查看已启动镜像
docker logs 容器名 查看容器日志
docker exec -it image_id bash 进入指定容器
docker ps -a 查询所有镜像
docker rm image_id 删除指定镜像
docker images 查看所有images
docker rmi iamges 删除images
docker rmi -f imageID 强制删除
docker start :启动一个或多个已经被停止的容器
docker stop :停止一个运行中的容器
docker restart :重启容器
docker network ls 查看网络列表
docker network create -d bridge --subnet=172.25.0.0/16 --gateway=172.25.0.1 tars
Error response from daemon: network with name tars already exists
创建虚拟网络
# 不指定网络驱动时默认创建的bridge网络
docker network create tars
# 查看网络内部信息
docker network inspect tars
列出所有的容器 ID
docker ps -aq
停止所有的容器
docker stop $(docker ps -aq)
删除所有的容器
docker rm $(docker ps -aq)
删除所有的镜像
docker rmi $(docker images -q)
复制文件
docker cp mycontainer:/opt/file.txt /opt/local/
docker cp /opt/local/file.txt mycontainer:/opt/
free -mh 查询内存
start and log
docker-compose up web explorer
日志本地机子 http://127.0.0.1:1235/
into the container
cd /home/wwwroot/ops-driver-operation-team/docker/ docker-compose exec web sh
dockerfiles
/home/wwwroot/ops-driver-operation-team/docker
Switch projects if necessary
edit
/home/wwwroot/ops-driver-operation-team/docker/.env CODE_PATH=/media/sf_test/edu-api.cn CODE_PATH=/media/sf_test/test-api.cn
/home/wwwroot/ops-driver-operation-team/docker shortcut path www
File mount path /media/sf_test fast forward path lanwww
apk --help 帮助
apk update 更新
apk search 搜索
apk add 安装软件
apk search
查找所有可用软件包
apk search -v
查找所有可用软件包及其描述内容
apk search -v ‘nginx*’
通过软件包名称查找软件包
apk search -v -d ‘nginx’
通过描述文件查找特定的软件包
apk command
https://blog.csdn.net/meanshe/article/details/119297585
Edit network card centos
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
restart network card
service network restart
View the status of the firewall
service iptable status
Turn off the firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
docker-compose up --build web //第一次执行 重新构建
docker-compose up web 执行命令
View network ip
ip addr
view port
netstat -ntlp //查看当前所有tcp端口
netstat -ntulp | grep 80 //查看所有80端口使用情况
netstat -ntulp | grep 3306 //查看所有3306端口使用情况
lsof -i:端口号
ps aux|grep 8898
kill port
Kill -9 port
Find php.ini location
cd /home/wwwroot/ops-driver-operation-team/docker/
docker-compose exec web sh
php -i | grep php.ini
cd /usr/local/etc/php
Install the bcmath extension
docker-php-ext-install bcmath
install acpu
docker-compose exec web sh
yum install pecl yum install php-devel php-pear httpd-devel
cd /home/wwwroot/ops-driver-operation-team/docker/
pecl install apcu
docker-php-ext-enable apcu
traditional installation
vim /etc/php.ini extension=apcu.so systemctl restart php-fpm
install kafka
git clone https://github.com/arnaud-lb/php-rdkafka.git
pecl install rdkafka
docker-php-ext-enable rdkafka
prcl
yum install php-devel php-pear httpd-devel
Execute phpunit in the container and enter the root directory
php vendor/phpunit/phpunit/phpunit
php vendor/phpunit/phpunit/phpunit --filter testPushClient 问卷
php vendor/phpunit/phpunit/phpunit --filter EduPushTest 教育
protect/Tests/Unit/SurveyPushTest.php 的方法 可以自己新建多个
xedebug
[xdebug]
zend_extension= /usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.idekey=PHPSTORM
xdebug.remote_enable=1
xdebug.remote_host=169.254.205.40
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.remote_handler=dbgp
dockerfile
version: '3.9'
services:
web:
build:
context: .
args:
- INSTALL_XHPROF=${INSTALL_XHPROF}
- INSTALL_KAFKA=${INSTALL_KAFKA}
labels:
- "cn.huolala.test=local"
ports:
- "8080:8080"
# - "9000:9000" xdebug 预留
volumes:
- ${CODE_PATH}:/code
- home:/home
extra_hosts:
#增加host映射
&host_map
- "kfk1-stg.test.cn:10.129.36.254"
- "kfk1-dev.test.cn:10.129.39.217"
- "dal-stg.test.cn:10.129.37.8"
- "dal-dev.test.cn:192.168.106.89"
- "dal-dev1.test.cn:192.168.146.31"
- "msg-plat-agent-stg.test.cn:10.129.27.28"
- "msg-plat-api-stg.test.cn:10.129.27.28"
- "dal-stg1.test.cn:10.129.37.7"
- "dal-stg.test.cn:10.138.0.150"
- "kfk1-stg.test.cn:10.138.2.89"
- "kfk2-stg.test.cn:10.138.2.88"
- "kfk3-stg.test.cn:10.138.2.90"
task:
build:
context: .
args:
- INSTALL_XHPROF=${INSTALL_XHPROF}
- INSTALL_KAFKA=${INSTALL_KAFKA}
volumes:
- ${CODE_PATH}:/code
- home:/home
extra_hosts: *host_map
command:
- /bin/sh
- -c
- |
crontab /code/devops/crontab.txt&
crond -f -l 8
daemon:
build:
context: .
args:
- INSTALL_XHPROF=${INSTALL_XHPROF}
- INSTALL_KAFKA=${INSTALL_KAFKA}
- INSTALL_SUPERVISOR=true
volumes:
- ${CODE_PATH}/supervisor:/etc/supervisor.d/
- ./daemon/supervisord.conf:/etc/supervisord.conf
- home:/home
command: supervisord -c /etc/supervisord.conf -n
extra_hosts: *host_map
explorer:
image: pipiqiang/tinyfilemanager
volumes:
- ${CODE_PATH}:/var/www/html/data/code
- home:/var/www/html/data/home
ports:
- "8081:80"
volumes:
home: {}
docker network error
docker network ls