尝试构建Docker容器,找不到start.sh [英] Trying to build a docker container, start.sh not found

查看:672
本文介绍了尝试构建Docker容器,找不到start.sh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个Docker容器,但似乎找不到我的start.sh。它将它复制到容器中,但不知何故。

I'm trying to build a docker container, but it doesn't seem to find my start.sh. It copies it to the container, but it somehow doesnt work.

这是我的dockerfile:

This is my dockerfile:

FROM ubuntu:16.04

# Install Meteor
RUN apt-get update
RUN apt-get install -y curl
RUN curl https://install.meteor.com/ | sh
RUN meteor npm install --save highcharts

# Entypointscript
COPY start.sh /
RUN chmod u+x /start.sh

# Copy App
COPY /app /app

# UI Expose
EXPOSE 80

ENTRYPOINT /start.sh

这是我的start.sh:

And this is my start.sh:

#!/bin/bash

sleep 20
/app/meteor run 

# don't exit 
/usr/bin/tail -f /dev/null

我也不知道流星运行命令在start.sh中。我如何告诉流星运行在特定目录中执行而又无法进入它?

Also I'm not sure about that meteor run command in the start.sh. How do I tell meteor run to be executed in a specific directory, without being able to cd into it?

我正在使用Windows10。
我的流星应用程序位于\app\目录中,而Dockerfile和start.sh与应用程序文件夹位于同一目录中。

I'm using Windows 10. I have my meteor app in the \app\ directory and the Dockerfile and start.sh in the same directory as the app folder.

我使用以下命令构建容器:docker build -t meteorapp。

I build the container using: docker build -t meteorapp .

我尝试使用以下错误运行:

The error when I'm trying to run using:


docker run -p 80:80 --net docker-network --name meteorapp meteorapp

docker run -p 80:80 --net docker-network --name meteorapp meteorapp

是:


/ bin / sh:1:/start.sh:找不到

/bin/sh: 1: /start.sh: not found

非常感谢!

推荐答案

结果证明我的文件没有任何问题。我在PC上创建了一个新目录,创建了新文件,并复制了start.sh和Dockerfile以及我的应用程序的内容。错误消失了。这一定是一个严重的错误,我的朋友在我的PC上也能正常工作的其他文件也遇到了同样的错误。

Turns out there wasn't anything wrong with my files. I created a new directory on my pc, created new files and copied the contents of the start.sh and Dockerfile and my app there. The error was gone. This has to be some serious bug, my friend just got the same error with other files that work on my pc as well.

在Docker和Windows 10上可能存在一些问题。

Maybe some issue with Docker and Windows 10.

编辑:无法为我的朋友和我再次遇到相同的问题。

couldn't fix it for my friend and I run into the same issue again. Someone an idea how to fix?

解决方案:这是与在Windows下创建且符合Linux需求的start.sh不兼容的解决方案。要解决此问题,请在复制start.sh之后将其添加到dockerfile中。

SOLUTION: It is a incompatibility of the start.sh which is created under windows and with the one linux needs. To solve this, add this to the dockerfile, after you copied the start.sh:


RUN dos2unix /start.sh

RUN dos2unix /start.sh

如果未安装dos2unix,则必须先安装:

If dos2unix is not installed, you have to install it first:


运行apt-get install dos2unix

RUN apt-get install dos2unix

这篇关于尝试构建Docker容器,找不到start.sh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆