今天,当我执行docker system prune
以便再次从头开始构建所有我的服务时,我的docker服务大手笔正在很好地构建util。现在,此特定服务(只有它)失败,并显示以下错误:
Building swagger
Step 1/10 : FROM nginx:1.15.8-perl
---> 7bb959be99b4
Step 2/10 : ENV SWAGGER_UI_VERSION 3.20.4
---> Running in 364ca6ef9b60
Removing intermediate container 364ca6ef9b60
---> 88aa04baa745
Step 3/10 : ENV URL **None**
---> Running in 3d48c38f7db0
Removing intermediate container 3d48c38f7db0
---> 76799da3d2d3
Step 4/10 : RUN apt-get update && apt-get install -y curl && curl -L https://github.com/swagger-api/swagger-ui/archive/v${SWAGGER_UI_VERSION}.tar.gz | tar -zxv -C /tmp && cp -R /tmp/swagger-ui-${SWAGGER_UI_VERSION}/dist/* /usr/share/nginx/html && rm -rf /tmp/*
---> Running in 6199b5dbdc9b
ERROR: Service 'swagger' failed to build: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknown
结构
docker-compose.yml
/
swagger/
Dockerfile-dev
start.sh
nginx.conf
swagger.json
文件
docker-compose.yml
swagger:
build:
context: ./services/swagger
dockerfile: Dockerfile-dev
volumes:
- './services/swagger/swagger.json:/usr/share/nginx/html/swagger.json'
ports:
- 3008:8080
environment:
- URL=swagger.json
depends_on:
- web
Dockerfile-dev
FROM nginx:1.15.8-perl
ENV SWAGGER_UI_VERSION 3.20.4
ENV URL **None**
RUN apt-get update \
&& apt-get install -y curl \
&& curl -L https://github.com/swagger-api/swagger-ui/archive/v${SWAGGER_UI_VERSION}.tar.gz | tar -zxv -C /tmp \
&& cp -R /tmp/swagger-ui-${SWAGGER_UI_VERSION}/dist/* /usr/share/nginx/html \
&& rm -rf /tmp/*
RUN rm /etc/nginx/conf.d/default.conf
COPY /nginx.conf /etc/nginx/conf.d
COPY swagger.json /usr/share/nginx/html/swagger.json
COPY start.sh /start.sh
RUN ["chmod", "+x", "/start.sh"]
CMD ["/start.sh"]
start.sh
#!/bin/bash
if [ $URL != "**None**" ]; then
sed -i -e 's@https://petstore.swagger.io/v2/swagger.json@'"$URL"'@g' /usr/share/nginx/html/index.html
fi
exec nginx -g 'daemon off;'
nginx.conf
server {
listen 8080;
root /usr/share/nginx/html/;
location / {
try_files $uri /index.html;
}
}
我不知道怎么回事。
有人可以在这里指出正确的方向吗?