简体   繁体   English

在Windows上运行Docker映像-docker-entrypoint.sh采购/docker-entrypoint-initdb.d

[英]Running docker images on Windows - docker-entrypoint.sh sourcing /docker-entrypoint-initdb.d

I am trying to run a docker image with a database for my API 我正在尝试为我的API运行带有数据库的docker映像

docker run -p 1232:1232 -t image/database

but this does not work. 但这不起作用。 The error I am getting is: 我得到的错误是:

/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/Z1init.sql
CREATE ROLE
CREATE DATABASE
GRANT

/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/Z2restoredb.sh
: invalid optionnt-initdb.d/Z2restoredb.sh: line 2: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]

I tried several things and nothing seems to be working. 我尝试了几件事似乎没有任何效果。

Okay so I managed to figure out what was the problem! 好的,所以我设法找出了问题所在! It was the Windows end-of-line characters! 这是Windows的行尾字符!

There were some files which did not have the proper end-of-line characters in my sh script, so all I had to do was to change the line separator from CRLF (Windows \\r\\n ) to LF (Unix \\n ) 我的sh脚本中有些文件没有正确的行尾字符,因此我要做的就是将行分隔符从CRLF(Windows \\r\\n )更改为LF(Unix \\n )。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM