我正在嘗試訪問我的Dart Docker容器的外殼
$ docker-compose exec dartserver sh
但我收到此錯誤訊息:
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "sh": executable file not found in $PATH: unknown
任何的想法?
Dockerfile
FROM dart:stable AS build
# Resolve app dependencies.
WORKDIR /app
COPY pubspec.* ./
RUN dart pub get
# Copy app source code (except anything in .dockerignore) and AOT compile app.
COPY . .
RUN dart compile exe bin/server.dart -o bin/server
# Build minimal serving image from AOT-compiled `/server`
# and the pre-built AOT-runtime in the `/runtime/` directory of the base image.
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/bin/server /app/bin/
# Start server.
EXPOSE 8080
CMD ["/app/bin/server"]
uj5u.com熱心網友回復:
該scratch影像默認沒有shell在里面。如果你真的想訪問 shell,我建議使用busybox image。
請參閱busybox dockerfile:
FROM scratch
ADD busybox.tar.xz /
CMD ["sh"]
它也是基于scratch的,但是啟用了shell,另外它仍然很小。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/405836.html
標籤:
上一篇:第一行替換的awk條件
