docker run -d \
--name mqsub \
--restart=always \
--network php-net \
-p 8000:80 \
-v /root/mqsub:/app \
-e KEEP_ALIVE="20" \
-e GRACEFUL_TIMEOUT="20" \
-e TIMEOUT="20" \
mqsub /start-reload.sh
#FROM centos/python-36-centos7
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
MAINTAINER sam
USER root
WORKDIR /app
# 下载pip包
RUN python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install wheel -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install pycrypto -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install mq_http_sdk -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install aliyunsdkcore -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple aliyun-python-sdk-iot
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple fastapi
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pydantic
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple uvicorn
#COPY requirements.txt /home/requirements.txt
# 使用淘宝的npm镜像
#RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
#RUN pip install -r requirements.txt
#ENTRYPOINT [ "/bin/bash", "/home/entry-point.sh"]
#ENTRYPOINT uwsgi --ini /home/hello.ini
#CMD ["uwsgi","--ini", "/home/hello.ini"] #启动uwsgi
docker run -d \
--restart=always \
-v /root/xy.api:/app \
--network php-net \
-p 3000:3000 \
--name xyys.nodejs \ #镜像名
xyys.nodejs \ #容器名
node /app/app.js #运行命令
docker run -d \
--restart=always \
--name php-web \
--network php-net \
-p 9001:9000 \
-v /www/nginx/apps:/usr/share/nginx/html \
php:5.6-fpm
sudo docker build -t mqsub .
#查看IP;
[root@localhost ~]# docker inspect myphp-fpm | grep "IPAddress"
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.3",
"IPAddress": "172.17.0.3",
#创建一个docker网络,使用docker来连接多个容器
[root@localhost ~]# docker network create -d bridge php-net
#加入docker网络的容器执行 docker run 命令时要加参数:--network
--network php-net \
#创建、修改配置文件: /etc/docker/daemon.json
vim /etc/docker/daemon.json # 编辑daemon.json
{
"registry-mirrors": ["http://docker.mirrors.ustc.edu.cn"]
}
systemctl restart docker # 重启docker服务
*强调
一个简单的表格是这么创建的:
项目 | Value |
---|---|
电脑 | $1600 |
手机 | $12 |
导管 | $1 |