Dockers

I have a folder structure as shown below

. ├── docker-compose.yml └── web-app ├── create_tomcat_admin.sh ├── Dockerfile ├── pom.xml └── run.sh 

And my docker-compose.yml is like

 version: '3' services: web-app: build: context: . dockerfile: web-app/Dockerfile ports: - 8080:8080 network_mode: "host" 

As soon as I execute docker-compose build , it runs fine and in the terminal it displays as below

 Step 10/15 : ADD /web-app/create_tomcat_admin_user.sh /create_tomcat_admin_user.sh ---> Using cache ---> 6ca9922b3628 Step 11/15 : ADD /web-app/run.sh /run.sh ---> Using cache ---> c1e843f2f67a Step 12/15 : RUN chmod +x /*.sh ---> Using cache ---> 6b8e781b830c Step 13/15 : COPY /web-app/target/*.war /tomcat/webapps ---> Using cache ---> fc046d9d1d3e Step 14/15 : EXPOSE 8080 ---> Using cache ---> 68f788c21a84 Step 15/15 : CMD /run.sh ---> Using cache ---> d88cc5594980 Successfully built d88cc5594980 Successfully tagged opt_web-app:latest` 

after creating docker-compose, when I execute docker-compose up it gives an error

 ben@ubuntu :~/Desktop/opt$ docker-compose up Starting opt_web-app_1 Attaching to opt_web-app_1 web-app_1 | standard_init_linux.go:187: exec user process caused "no such file or directory" opt_web-app_1 exited with code 1 ben@ubuntu :~/Desktop/opt$ 

Where am I going wrong? But should the error be displayed when building docker-compose.yml to the right?

+5
source share
1 answer

I had the same useless error when I tried to launch docker-compose on Windows from a project that I created on Linux. If you clone a Linux project on Windows, by default, Git adds Windows-style line endings that will ruin any Bash scripts. If so, run git config --global core.autocrlf false to configure Git to never change line endings. Then delete the repository and re-clone it.

Alternatively, if you initially created a project on Windows, many times the IDE adds a Windows-style line ending. If so, then in Notepad ++, click the edit menu> EOL Conversion> Unix.

0
source

Source: https://habr.com/ru/post/1269465/


All Articles