docker-compose -f docker-compose-mssql.yml up -d --build --remove-orphans
我的项目运行时出现以下错误。
E:获取失败 http://deb.debian.org/debian/pool/main/l/linux/linux-libc-dev_5.10.70-1_amd64.deb 404 未找到 [IP: 199.232.22.132 80]
E:无法获取某些档案,也许运行 apt-get update 或尝试使用 --fix-missing?
完整日志如下:
WARNING: Python-dotenv could not parse statement starting at line 1
WARNING: Python-dotenv could not parse statement starting at line 2
WARNING: Python-dotenv could not parse statement starting at line 3
Building flask-dev
Sending build context to Docker daemon 756.2kB
Step 1/19 : FROM python:3.7-slim
---> 3e12d0db6381
Step 2/19 : ENV APP_HOME /usr/src/app
---> Using cache
---> 547384aa23b8
Step 3/19 : WORKDIR ${APP_HOME}
---> Using cache
---> 44ceae2297e4
Step 4/19 : RUN apt-get update && apt-get install -y netcat
---> Using cache
---> 52fa30e15a2f
Step 5/19 : RUN apt-get --assume-yes update
---> Using cache
---> 47be10d9ea1c
Step 6/19 : RUN apt-get --assume-yes install freetds-dev freetds-bin
---> Using cache
---> 177aac289cf6
Step 7/19 : RUN apt-get install gcc -y
---> Running in b92d29973cf4
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-10
fontconfig-config fonts-dejavu-core gcc-10 libasan6 libatomic1 libbinutils
libbrotli1 libc-dev-bin libc-devtools libc6-dev libcc1-0 libcrypt-dev
libctf-nobfd0 libctf0 libdeflate0 libfontconfig1 libfreetype6 libgcc-10-dev
libgd3 libgomp1 libisl23 libitm1 libjbig0 libjpeg62-turbo liblsan0 libmpc3
libmpfr6 libnsl-dev libpng16-16 libquadmath0 libtiff5 libtirpc-dev libtsan0
libubsan1 libwebp6 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4
linux-libc-dev manpages manpages-dev sensible-utils ucf
Suggested packages:
binutils-doc cpp-doc gcc-10-locales gcc-multilib make autoconf automake
libtool flex bison gdb gcc-doc gcc-10-multilib gcc-10-doc glibc-doc
libgd-tools man-browser
The following NEW packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-10
fontconfig-config fonts-dejavu-core gcc gcc-10 libasan6 libatomic1
libbinutils libbrotli1 libc-dev-bin libc-devtools libc6-dev libcc1-0
libcrypt-dev libctf-nobfd0 libctf0 libdeflate0 libfontconfig1 libfreetype6
libgcc-10-dev libgd3 libgomp1 libisl23 libitm1 libjbig0 libjpeg62-turbo
liblsan0 libmpc3 libmpfr6 libnsl-dev libpng16-16 libquadmath0 libtiff5
libtirpc-dev libtsan0 libubsan1 libwebp6 libx11-6 libx11-data libxau6
libxcb1 libxdmcp6 libxpm4 linux-libc-dev manpages manpages-dev
sensible-utils ucf
0 upgraded, 52 newly installed, 0 to remove and 1 not upgraded.
Need to get 54.8 MB of archives.
After this operation, 192 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 sensible-utils all 0.0.14 [14.8 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 manpages all 5.10-1 [1412 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 ucf all 3.0043 [74.0 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 binutils-common amd64 2.35.2-2 [2220 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 libbinutils amd64 2.35.2-2 [570 kB]
Get:6 http://deb.debian.org/debian bullseye/main amd64 libctf-nobfd0 amd64 2.35.2-2 [110 kB]
Get:7 http://deb.debian.org/debian bullseye/main amd64 libctf0 amd64 2.35.2-2 [53.2 kB]
Get:8 http://deb.debian.org/debian bullseye/main amd64 binutils-x86-64-linux-gnu amd64 2.35.2-2 [1809 kB]
Get:9 http://deb.debian.org/debian bullseye/main amd64 binutils amd64 2.35.2-2 [61.2 kB]
Get:10 http://deb.debian.org/debian bullseye/main amd64 libisl23 amd64 0.23-1 [676 kB]
Get:11 http://deb.debian.org/debian bullseye/main amd64 libmpfr6 amd64 4.1.0-3 [2012 kB]
Get:12 http://deb.debian.org/debian bullseye/main amd64 libmpc3 amd64 1.2.0-1 [45.0 kB]
Get:13 http://deb.debian.org/debian bullseye/main amd64 cpp-10 amd64 10.2.1-6 [8528 kB]
Get:14 http://deb.debian.org/debian bullseye/main amd64 cpp amd64 4:10.2.1-1 [19.7 kB]
Get:15 http://deb.debian.org/debian bullseye/main amd64 fonts-dejavu-core all 2.37-2 [1069 kB]
Get:16 http://deb.debian.org/debian bullseye/main amd64 fontconfig-config all 2.13.1-4.2 [281 kB]
Get:17 http://deb.debian.org/debian bullseye/main amd64 libcc1-0 amd64 10.2.1-6 [47.0 kB]
Get:18 http://deb.debian.org/debian bullseye/main amd64 libgomp1 amd64 10.2.1-6 [99.9 kB]
Get:19 http://deb.debian.org/debian bullseye/main amd64 libitm1 amd64 10.2.1-6 [25.8 kB]
Get:20 http://deb.debian.org/debian bullseye/main amd64 libatomic1 amd64 10.2.1-6 [9008 B]
Get:21 http://deb.debian.org/debian bullseye/main amd64 libasan6 amd64 10.2.1-6 [2065 kB]
Get:22 http://deb.debian.org/debian bullseye/main amd64 liblsan0 amd64 10.2.1-6 [828 kB]
Get:23 http://deb.debian.org/debian bullseye/main amd64 libtsan0 amd64 10.2.1-6 [2000 kB]
Get:24 http://deb.debian.org/debian bullseye/main amd64 libubsan1 amd64 10.2.1-6 [777 kB]
Get:25 http://deb.debian.org/debian bullseye/main amd64 libquadmath0 amd64 10.2.1-6 [145 kB]
Get:26 http://deb.debian.org/debian bullseye/main amd64 libgcc-10-dev amd64 10.2.1-6 [2328 kB]
Get:27 http://deb.debian.org/debian bullseye/main amd64 gcc-10 amd64 10.2.1-6 [17.0 MB]
Get:28 http://deb.debian.org/debian bullseye/main amd64 gcc amd64 4:10.2.1-1 [5192 B]
Get:29 http://deb.debian.org/debian bullseye/main amd64 libbrotli1 amd64 1.0.9-2+b2 [279 kB]
Get:30 http://deb.debian.org/debian bullseye/main amd64 libc-dev-bin amd64 2.31-13+deb11u2 [275 kB]
Get:31 http://deb.debian.org/debian bullseye/main amd64 libpng16-16 amd64 1.6.37-3 [294 kB]
Get:32 http://deb.debian.org/debian bullseye/main amd64 libfreetype6 amd64 2.10.4+dfsg-1 [418 kB]
Get:33 http://deb.debian.org/debian bullseye/main amd64 libfontconfig1 amd64 2.13.1-4.2 [347 kB]
Get:34 http://deb.debian.org/debian bullseye/main amd64 libjpeg62-turbo amd64 1:2.0.6-4 [151 kB]
Get:35 http://deb.debian.org/debian bullseye/main amd64 libdeflate0 amd64 1.7-1 [53.1 kB]
Get:36 http://deb.debian.org/debian bullseye/main amd64 libjbig0 amd64 2.1-3.1+b2 [31.0 kB]
Get:37 http://deb.debian.org/debian bullseye/main amd64 libwebp6 amd64 0.6.1-2.1 [258 kB]
Get:38 http://deb.debian.org/debian bullseye/main amd64 libtiff5 amd64 4.2.0-1 [289 kB]
Get:39 http://deb.debian.org/debian bullseye/main amd64 libxau6 amd64 1:1.0.9-1 [19.7 kB]
Get:40 http://deb.debian.org/debian bullseye/main amd64 libxdmcp6 amd64 1:1.1.2-3 [26.3 kB]
Get:41 http://deb.debian.org/debian bullseye/main amd64 libxcb1 amd64 1.14-3 [140 kB]
Get:42 http://deb.debian.org/debian bullseye/main amd64 libx11-data all 2:1.7.2-1 [311 kB]
Get:43 http://deb.debian.org/debian bullseye/main amd64 libx11-6 amd64 2:1.7.2-1 [772 kB]
Get:44 http://deb.debian.org/debian bullseye/main amd64 libxpm4 amd64 1:3.5.12-1 [49.1 kB]
Get:45 http://deb.debian.org/debian bullseye/main amd64 libgd3 amd64 2.3.0-2 [137 kB]
Get:46 http://deb.debian.org/debian bullseye/main amd64 libc-devtools amd64 2.31-13+deb11u2 [245 kB]
Err:47 http://deb.debian.org/debian bullseye/main amd64 linux-libc-dev amd64 5.10.70-1
404 Not Found [IP: 199.232.22.132 80]
Get:48 http://deb.debian.org/debian bullseye/main amd64 libcrypt-dev amd64 1:4.4.18-4 [104 kB]
Get:49 http://deb.debian.org/debian bullseye/main amd64 libtirpc-dev amd64 1.3.1-1 [190 kB]
Get:50 http://deb.debian.org/debian bullseye/main amd64 libnsl-dev amd64 1.3.0-2 [66.4 kB]
Get:51 http://deb.debian.org/debian bullseye/main amd64 libc6-dev amd64 2.31-13+deb11u2 [2344 kB]
Get:52 http://deb.debian.org/debian bullseye/main amd64 manpages-dev all 5.10-1 [2309 kB]
E: Failed to fetch http://deb.debian.org/debian/pool/main/l/linux/linux-libc-dev_5.10.70-1_amd64.deb 404 Not Found [IP: 199.232.22.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Fetched 53.4 MB in 2s (22.1 MB/s)
The command '/bin/sh -c apt-get install gcc -y' returned a non-zero code: 100
ERROR: Service 'flask-dev' failed to build : Build failed
docker-compose-mssql.yml
以下文件的内容:
version: "3"
services:
# FLASK
flask-dev:
container_name: flask-dev
hostname: flask-dev
platform: linux/x86_64
build:
context: ./server
volumes:
- ./server/:/usr/src/app/
ports:
- 5000:5000
- 5678:5678
env_file:
- ./env/dev/flask_mssql.env
networks:
- appnetwork
- dbnetwork
db-dev:
container_name: db-dev
image: mcr.microsoft.com/azure-sql-edge:latest
ports:
- 1433:1433
env_file: ./env/dev/mssql_db.env
volumes:
- my_dbdata:/var/lib/azuresqledge/data
networks:
- dbnetwork
networks:
dbnetwork:
driver: bridge
appnetwork:
driver: bridge
volumes:
my_dbdata:
pgadmin:
我的内容Dockerfile
如下:FROM python:3.7-slim
环境 APP_HOME /usr/src/app
WORKDIR ${APP_HOME}
# Initial setup
RUN apt-get update && apt-get install -y netcat
RUN apt-get --assume-yes update
RUN apt-get --assume-yes install freetds-dev freetds-bin
RUN apt-get install gcc -y
RUN apt-get install libssl-dev -y
RUN apt-get install unixodbc -y
RUN apt-get install unixodbc-dev -y
RUN apt-get install freetds-dev -y
RUN apt-get install freetds-bin -y
RUN apt-get install tdsodbc -y
RUN apt-get install --reinstall build-essential -y
#RUN apt-get update \
# && apt-get install unixodbc -y \
# && apt-get install unixodbc-dev -y \
# && apt-get install freetds-dev -y \
# && apt-get install freetds-bin -y \
# && apt-get install tdsodbc -y \
# && apt-get install --reinstall build-essential -y
#
## populate "ocbcinst.ini"
#RUN echo "[FreeTDS]\n\
#Description = FreeTDS unixODBC Driver\n\
#Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\n\
#Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so" >> /etc/odbcinst.ini
COPY ./requirements.txt .
RUN pip install -r requirements.txt
RUN mkdir -p /home/vagrant/app-data/
# Copy all files
COPY . .
# Run entrypoint checks
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
我将源列表更新如下:https://gist.github.com/ishad0w/788555191c7037e249a439542c53e170但可以apt-get update
正常运行,但上述问题仍然存在。请帮忙!
这行代码Dockerfile
给了我错误:RUN apt-get install gcc -y
无法找到文件linux-libc-dev_5.10.70-1_amd64.deb
这里,但当我sudo apt-get install gcc
手动运行时,它按预期工作,没有任何错误。
答案1
我遇到了同样的问题。对我来说,问题是我的“apt update -y”步骤被缓存了,因此包含了错误的存储库。通过强制它不使用缓存来修复它。看起来你的第 4 步也一样 :)
要在运行前清除缓存,请使用docker builder prune
或如果这不起作用(因为它对我来说不起作用)尝试一些更激进的方法,例如docker system prune --all