我正在设置一个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文件中的一些命令吗?