I'm trying to run the docker-compose.yml and it says readdirent:opeartion not permitted. can anyone please let me know what is the issue here ?
services:
container_name:
image: <image-url>
hostname: <host-name>
env_file:
- env/envfile.env
volumes:
- type: bind
source: ./config
target: /config
read_only: true
- type: volume
source: <source location>
target: <target location>
Related
I am trying to run my java application (a project at my uni) in debug mode in IntelliJ with a dockerfile.
I found this tutorial:
https://www.jetbrains.com/help/idea/debug-a-java-application-using-a-dockerfile.html#create-remote-debug-config
I tried to follow each step (#create-remote-debug-configuration), but at 4:
Select the Docker configuration that runs your app (MyPassApp) and
specify the command to use when running your app in the Custom Command
field. The remote debug configuration will use this custom command
instead of the one defined in the Dockerfile. This command should
contain the -agentlib option to let the debugger attach to the
process:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -jar JavaPassFromConsole.jar
I don't know what any of those commands mean, so I dont know what to put in the custom command section.
This is my docker-compose.yml file:
version: '3'
volumes: mysql_data: {}
networks:
back:
services:
backend:
build:
context: '.'
dockerfile: 'docker_config/backend/Dockerfile'
depends_on:
- db
links:
- db
ports:
- 8080:8080
- 9990:9990
environment:
CONTACT_USERNAME: <XXX>
CONTACT_PASSWORD: <XXX>
networks:
- back db:
container_name: db
image: mysql:5.7
restart: always
volumes:
- mysql_data:/var/lib/mysql
command: --lower_case_table_names=1
environment:
MYSQL_DATABASE: <XXX>
MYSQL_ROOT_PASSWORD: root
networks:
- back
ports:
- 3306:3306
- 5005:5005 phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- 4000:80
environment:
MYSQL_ROOT_PASSWORD: root
networks:
- back
Any help is appreciated!!
I am trying to build a local network for two services with a docker compose file.
service mysqldb - the data base for the spring boot app.
service app - the spring boot app.
this is the error i am receiving:
these are my files
Dockerfile
FROM maven:3.8.3-jdk-8
WORKDIR /mile-restoraunt-app
COPY . .
RUN mvn clean install
CMD mvn spring-boot:run
docker-compose.yml file
version: "3.8"
services:
mysqldb:
image: mysql
restart: unless-stopped
env_file: ./.env
environment:
- MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD
- MYSQL_DATABASE=$MYSQLDB_DATABASE
ports:
- $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT
volumes:
- db:/var/lib/mysql
app:
depends_on:
- mysqldb
build: ./mile-restoraunt-app
restart: on-failure
env_file: ./.env
ports:
- $SPRING_LOCAL_PORT:$SPRING_DOCKER_PORT
environment:
SPRING_APPLICATION_JSON: '{
"spring.datasource.url" : "jdbc:mysql://mysqldb:$MYSQLDB_DOCKER_PORT/$MYSQLDB_DATABASE?useSSL=false",
"spring.datasource.username" : "$MYSQLDB_USER",
"spring.datasource.password" : "$MYSQLDB_ROOT_PASSWORD",
"spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.MySQL5InnoDBDialect",
"spring.jpa.hibernate.ddl-auto" : "update"
}'
volumes:
- .m2:/root/.m2
stdin_open: true
tty: true
volumes:
db:
.env file
MYSQLDB_USER=root
MYSQLDB_ROOT_PASSWORD=thanatos
MYSQLDB_DATABASE=restaurant
MYSQLDB_LOCAL_PORT=3307
MYSQLDB_DOCKER_PORT=3306
SPRING_LOCAL_PORT=6868
SPRING_DOCKER_PORT=8080
And this is my directory
in docker-compose.yaml for a app you specified build: ./mile-restoraunt-app, but you run your command inside the mile-restoraunt-app folder. You need to change the build folder.
my docker-compose.yml file
version: "3.9"
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"
my err :
ERROR: In file './docker-compose.yml', service 'build' must be a mapping not a string.
Make sure you are not using TABs, but just SPACEs ( YAML does not support TABS)
Also, You have wrong indentation in your YAML file:
it should be:
version: "3.9"
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"
I am trying to do a httpRequest from library to people-service, but not that i've tried works.
i saw that if use the name it shoud ork, so i have tried http://library:8080, but it returns the error
java.lang.IllegalArgumentException: unsupported URI
Here is my Dockerfile:
FROM openjdk:11-jdk-slim
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
and my docker-compose:
version: '3.5'
services:
library:
build:
context: ./
ports:
- "8081:8081"
networks:
- library-network
restart: on-failure
mysql-service:
image: mysql:5.7
ports:
- "3306:3306"
networks:
- library-network
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_USER=admin
- MYSQL_PASSWORD=admin
- MYSQL_DATABASE=bootdb
restart: on-failure
people-service:
build:
context: ./
args:
JAR_FILE: ./target/library.jar
ports:
- "8080:8080"
environment:
- DB_HOST=jdbc:mysql://mysql-service:3306/library
networks:
- library-network
depends_on:
- mysql-service
- library
restart: on-failure
networks:
library-network:
driver: bridge
Your question says:
I am trying to do a httpRequest from library to people-service
From that I assume the request would be initiated in library. Then the URL should look like http://people-service:8080.
But from the error message I'd assume your library is not able to run http requests - regardless of where they are going to, which is a bit strange. Investigate on that first, using simple urls like http://stackoverflow.com (which will return http status 301).
I have a simple dockerized app that contains 3 services: Postgres, java (spring boot) as backend and a react frontend. Given the following docker-compose file:
version: "3.3"
services:
postgres:
image: postgres:12.2-alpine
environment:
POSTGRES_PASSWORD: password
volumes:
- dbdata:/var/lib/postgresql/data
ports:
- "25432:5432"
restart: unless-stopped
test-report:
build:
context: .
dockerfile: Dockerfile-test-report
restart: unless-stopped
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/postgres
ports:
- "25000:5000"
depends_on:
- "postgres"
webclient:
build:
context: .
dockerfile: Dockerfile-webclient
ports:
- "23000:5000"
environment:
- HOST=webclient
- PORT=5000
- REPORTS_URL=http://test-report:5000/
command: "npm run serve"
volumes:
dbdata:
I cannot make react send requests to the correct URL from inside docker. Locally, adding a .env file with REPORTS_URL=http://localhost:25000/ (same java service running inside docker) works. Please see below my setupProxy.js file:
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/api',
createProxyMiddleware({
target: process.env.REPORTS_URL,
changeOrigin: true,
secure: false
})
);
};
Any idea what is wrong? From docker, the response of the request is an index.html file