简体   繁体   中英

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

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!

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 )

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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