美文网首页
docker使用笔记-更改包

docker使用笔记-更改包

作者: 夜半_月清 | 来源:发表于2021-10-27 13:40 被阅读0次

1.想实现docker中tkinter的实例

原始文件:dokcerfile

-----------------------------------------------------

FROM ubuntu:20.04

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

sudo \

unzip \

wget

WORKDIR /opt

RUN wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh && \

sh /opt/Anaconda3-2020.11-Linux-x86_64.sh -b -p /opt/anaconda3 && \

rm -f Anaconda3-2020.11-Linux-x86_64.sh

ENV PATH /opt/anaconda3/bin:$PATH

RUN pip install --upgrade pip

RUN pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ --trusted-host pypi.mirrors.ustc.edu.cn PyMySQL

WORKDIR /work

CMD ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--LabApp.token=''"]

----------------------------------

docker-compose.yml

----------------------------------

version: '3'

services:

  analysis:

    build: .

    ports:

      - '8888:8888'

    volumes:

      - '.:/work'

--------------------------------

改成:dockerfile

-------------------------------

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

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

sudo \

unzip \

wget \

python3-tk \  

tk-dev \

ffmpeg

WORKDIR /opt

RUN wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh && \

sh /opt/Anaconda3-2020.11-Linux-x86_64.sh -b -p /opt/anaconda3 && \

rm -f Anaconda3-2020.11-Linux-x86_64.sh

ENV PATH /opt/anaconda3/bin:$PATH

RUN pip install --upgrade pip

RUN pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ --trusted-host pypi.mirrors.ustc.edu.cn PyMySQL

COPY requirements.txt .

RUN pip install -r requirements.txt

WORKDIR /work

CMD ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--LabApp.token=''"]

-----------------------

docker-compose.yml

------------------------

version: '3'

services:

  tktest:

    build: .

    ports:

      - '7777:8888'

    volumes:

      - '.:/work'

--------------------------

requirements.txt

--------------------------

pygame

1.端口已经切换成7777
2.pygame已经安装进去了,tkinter有没有完整按照不确定,但是加载界面却始终未成功,已经进入了linux系统界面但是执行命令总是报错。

相关文章

网友评论

      本文标题:docker使用笔记-更改包

      本文链接:https://www.haomeiwen.com/subject/ggfpaltx.html