How can I make my entrypoint.sh not add any errors once I have generated the logs command in dockers?

0

**

  

I'm having problems directly with the entrypoint, it does not let me access the link . Once it looks for the entrypoint, this error occurs:   users_1 | sh: /usr/src/app/entrypoint.sh: not found   I'm working on Windows.

When I run the 'logs' command this happens,:

docker-compose -f docker-compose-dev.yml logs
Attaching to testdriven-app_users_1, testdriven-app_users-db_1
users_1     | sh: /usr/src/app/entrypoint.sh: not found
users-db_1  | The files belonging to this database system will be owned by user "postgres".
users-db_1  | This user must also own the server process.
users-db_1  |
users-db_1  | The database cluster will be initialized with locale "en_US.utf8".
users-db_1  | The default database encoding has accordingly been set to "UTF8".
users-db_1  | The default text search configuration will be set to "english".
users-db_1  |
users-db_1  | Data page checksums are disabled.
users-db_1  |
users-db_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
users-db_1  | creating subdirectories ... ok
users-db_1  | selecting default max_connections ... 100
users-db_1  | selecting default shared_buffers ... 128MB
users-db_1  | selecting dynamic shared memory implementation ... posix
users-db_1  | creating configuration files ... ok
users-db_1  | running bootstrap script ... ok
users-db_1  | sh: locale: not found
users-db_1  | 2018-08-15 22:40:18.445 UTC [25] WARNING:  no usable system locales were found
users-db_1  | performing post-bootstrap initialization ... ok
users-db_1  | syncing data to disk ... ok
users-db_1  |
users-db_1  | Success. You can now start the database server using:
users-db_1  |
users-db_1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
users-db_1  |
users-db_1  |
users-db_1  | WARNING: enabling "trust" authentication for local connections
users-db_1  | You can change this by editing pg_hba.conf or using the option -A, or
users-db_1  | --auth-local and --auth-host, the next time you run initdb.
users-db_1  | waiting for server to start....2018-08-15 22:40:19.863 UTC [29] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
users-db_1  | 2018-08-15 22:40:19.928 UTC [30] LOG:  database system was shut down at 2018-08-15 22:40:18 UTC
users-db_1  | 2018-08-15 22:40:19.940 UTC [29] LOG:  database system is ready to accept connections
users-db_1  |  done
users-db_1  | server started
users-db_1  | ALTER ROLE
users-db_1  |
users-db_1  |
users-db_1  | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/create.sql
users-db_1  | CREATE DATABASE
users-db_1  | CREATE DATABASE
users-db_1  | CREATE DATABASE
users-db_1  |
users-db_1  |
users-db_1  | waiting for server to shut down...2018-08-15 22:40:21.603 UTC [29] LOG:  received fast shutdown request
users-db_1  | .2018-08-15 22:40:21.610 UTC [29] LOG:  aborting any active transactions
users-db_1  | 2018-08-15 22:40:21.612 UTC [29] LOG:  worker process: logical replication launcher (PID 36) exited with exit code 1
users-db_1  | 2018-08-15 22:40:21.613 UTC [31] LOG:  shutting down
users-db_1  | 2018-08-15 22:40:21.679 UTC [29] LOG:  database system is shut down
users-db_1  |  done
users-db_1  | server stopped
users-db_1  |
users-db_1  | PostgreSQL init process complete; ready for start up.
users-db_1  |
users-db_1  | 2018-08-15 22:40:21.733 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
users-db_1  | 2018-08-15 22:40:21.734 UTC [1] LOG:  listening on IPv6 address "::", port 5432
users-db_1  | 2018-08-15 22:40:21.755 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
users-db_1  | 2018-08-15 22:40:21.809 UTC [42] LOG:  database system was shut down at 2018-08-15 22:40:21 UTC
users-db_1  | 2018-08-15 22:40:21.822 UTC [1] LOG:  database system is ready to accept connections

** Start of the Dockerfile

# base image
FROM python:3.6.5-alpine

# new
# install dependencies
RUN apk update && \
    apk add --virtual build-deps gcc python-dev musl-dev && \
    apk add postgresql-dev && \
    apk add netcat-openbsd

# set working directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# add and install requirements
COPY ./requirements.txt /usr/src/app/requirements.txt

RUN pip install -r requirements.txt

# new
# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod -R 755 /usr/src/app/entrypoint.sh

# add app
COPY . /usr/src/app

# new
# run server
CMD ["sh", "/usr/src/app/entrypoint.sh"]

** Start of entrypoint.sh

#!/bin/sh

echo "Waiting for postgres..."
while [ ! nc -z users-db 5435 ]
do
  sleep 0.1
done

echo "PostgreSQL started"
python manage.py run -h 0.0.0.0

When I use the 'logs' command in docker, the users_1 container has this error:

  

/usr/src/app/entrypoint.sh: line 8: syntax error: unexpected end of   file (expecting "do")

    
asked by Andres 16.08.2018 в 01:19
source

0 answers