Python Cmd库在Docker容器中不起作用

时间:2019-07-07 12:30:09

标签: python docker alpine

我正在尝试对应用程序进行docker化,但cmd出现问题 cmd library 当我运行docker时,我得到了cmd提示符,但随后的任何命令都停止了。我不知道我是否应该用它运行一些外壳程序

FROM alpine:3.7

RUN apk upgrade \
  && apk add --no-cache --update \
    musl \
    build-base \
    python3 \
    python3-dev \
    postgresql-dev \
    bash \
    git \
  && python3
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install virtualenv
RUN rm -rf /var/cache/apk/*

RUN cd /usr/bin \
  && ln -sf python3 python \
  && ln -sf pip3 pip

COPY . /app
WORKDIR /app

RUN virtualenv venv
RUN source venv/bin/activate
CMD ["python","test_app/app.py"]

from resource import HelpShell

if __name__ == '__main__':
  tree_shell = HelpShell()
  tree_shell.cmdloop()

from cmd import Cmd

class HelpShell(Cmd):
    intro = 'Type help or ? to list commands.\n'
    prompt = '(bccs>) '

    def do_add(self):
        print('Hello')

0 个答案:

没有答案