python代码进去docker容器内_python – 在docker容器中运行py.test作为服务

我正在设置一个dockerised selenium网格.我可以通过附加到pytest容器[见下面]发送我的python测试[用pytest运行].

但是我已经设置了另一个控制pytest的LAMP容器.

所以我想让pytest容器独立,运行空闲并等待来自LAMP容器的命令.

我有这个Dockerfile:

# Starting from base image

FROM ubuntu

#-----------------------------------------------------

# Set the Github personal token

ENV GH_TOKEN blablabla

# Install Python & pip

RUN apt-get update

RUN apt-get upgrade -y

RUN apt-get install -y python python-pip python-dev && pip install --upgrade pip

# Install nano for #debugging

RUN apt-get install -y nano

# Install xvfb

RUN apt-get install -y xvfb

# Install GIT

RUN apt-get update -y && apt-get install git -y

# [in the / folder]

RUN git clone https://$GH_TOKEN:x-oauth-basic@github.com/user/project.git /project

# Install dependencies via pip

WORKDIR /project

RUN pip install -r dependencies.txt

#-----------------------------------------------------

#

CMD ["/bin/bash"]

我手动启动pytest容器[用于开发]:

docker run -dit -v /project --name pytest repo/user:py

问题是我完成了开发,我希望从docker-compose启动pytest容器并将其连接到其他容器[带链接和卷].

我无法让它熬夜.

我用过这个:

pytest:

image: repo/user:py

volumes:

- "/project"

command: "/bin/bash tail -f /dev/null"

但没有工作.

那么,在Dockerfile中,我应该使用特定的CMD还是ENTRYPOINT?

我应该使用docker-compose文件中的一些命令吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值