Reputation: 6257
I'm trying to access the my Dart Docker container's shell
$ docker-compose exec dartserver sh
but I'm getting this error message:
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "sh": executable file not found in $PATH: unknown
Any idea?
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"]
Upvotes: 1
Views: 585
Reputation: 31654
The scratch
image default don't have shell
in it. If you really want to access shell, what I suggest is to use busybox image.
See busybox
dockerfile:
FROM scratch
ADD busybox.tar.xz /
CMD ["sh"]
It's also based on scratch, but with shell enable, additionally it's still very small.
Upvotes: 2