关于docker镜像的基础镜像没有固定版本导致的运行出错
出现问题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
root@sha:~# docker run -it --rm --privileged minirplus/speedtest-cli:latest --no-upload --server 3633 Retrieving speedtest.net configuration... Traceback (most recent call last): File "/usr/local/bin/speedtest-cli", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.10/site-packages/speedtest.py", line 1986, in main shell() File "/usr/local/lib/python3.10/site-packages/speedtest.py", line 1872, in shell speedtest = Speedtest( File "/usr/local/lib/python3.10/site-packages/speedtest.py", line 1091, in __init__ self.get_config() File "/usr/local/lib/python3.10/site-packages/speedtest.py", line 1173, in get_config ignore_servers = list( ValueError: invalid literal for int() with base 10: '' |
原因
由于未指定基础镜像版本,导致拉取到最近的python3.10后不兼容旧版代码出错
解决
将原Dockerfile中的python:rc-alpine3.13
1 2 3 |
FROM python:rc-alpine3.13 RUN pip3 install speedtest-cli ENTRYPOINT ["speedtest-cli"] |
改为python:3.7.10-alpine3.13,将基础镜像限制为python:3.7
1 2 3 |
FROM python:3.7.10-alpine3.13 RUN pip3 install speedtest-cli ENTRYPOINT ["speedtest-cli"] |
There are no comments yet