gpt4 book ai didi

python-3.x - 进入入口点后进入容器提示的命令

转载 作者:行者123 更新时间:2023-12-02 19:04:05 25 4
gpt4 key购买 nike

可以在Dockerfile的底部添加什么命令以在ENNTRYPOINT之后进入容器提示符? Dockerfile运行正常。只是它可以从执行位置返回到提示。

 # Pull base image
From ubuntu:18.04
LABEL maintainer="tester@gmail.com"

# Install dependencies
RUN apt-get update -y
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv
RUN apt-get install -y vim
RUN python3.6 -m pip install pip --upgrade
RUN pip3 install pytest pytest-cache
RUN pip3 install pylint
RUN pip3 install requests

# Create working directory
RUN mkdir /testsuite

# Copy project
COPY comments_categories_api /testsuite/comments_categories_api
COPY comments_posts_api /testsuite/comments_posts_api/
RUN chmod -R a+rwX testsuite/
# Set working directory

WORKDIR /testsuite
# Set Python version
RUN echo alias python='/usr/bin/python3' >> ~/.bashrc
# RUN echo cd testsuite/ >> ~/.bashrc

# Define ENTRYPOINT
COPY ./docker-entrypoint.sh /testsuite/docker-entrypoint.sh
RUN ["chmod", "+x", "/testsuite/docker-entrypoint.sh"]
ENTRYPOINT ["sh", "/testsuite/docker-entrypoint.sh"]

最佳答案

以“$ @”结束您的docker-entrypoint.sh。这是一个例子:

#!/bin/bash

echo Hello

$@

===更新

根据您的评论,文件应为:
#!/bin/bash

pytest -v

$@

关于python-3.x - 进入入口点后进入容器提示的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55963150/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com