question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.net.SocketException: Permission denied

See original GitHub issue

Describe the bug I got the below error when docker-compose up.

Recreating local-data-api_local-data-api_1 ... done
Recreating local-data-api_db_1             ... done
Attaching to local-data-api_local-data-api_1, local-data-api_db_1
local-data-api_1  | 2021-04-03 04:08:54.069 [main] TRACE Application - {
local-data-api_1  |     # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 6
local-data-api_1  |     "application" : {
local-data-api_1  |         # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 7
local-data-api_1  |         "modules" : [
local-data-api_1  |             # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 7
local-data-api_1  |             "com.koxudaxi.localDataApi.ApplicationKt.module"
local-data-api_1  |         ]
local-data-api_1  |     },
local-data-api_1  |     # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 2
local-data-api_1  |     "deployment" : {
local-data-api_1  |         # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 3
local-data-api_1  |         "port" : 8080
local-data-api_1  |     },
local-data-api_1  |     # Content hidden
local-data-api_1  |     "security" : "***"
local-data-api_1  | }
local-data-api_1  |
local-data-api_1  | 2021-04-03 04:08:54.142 [main] INFO  Application - Autoreload is disabled because the development mode is off.
db_1              | 2021-04-03 04:08:54.269 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1              | 2021-04-03 04:08:54.269 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1              | 2021-04-03 04:08:54.410 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
local-data-api_1  | 2021-04-03 04:08:54.532 [main] INFO  Application - Responding at http://0.0.0.0:80
db_1              | 2021-04-03 04:08:54.560 UTC [20] LOG:  database system was shut down at 2021-04-03 04:08:25 UTC
db_1              | 2021-04-03 04:08:54.593 UTC [1] LOG:  database system is ready to accept connections
local-data-api_1  | Exception in thread "main" java.net.SocketException: Permission denied
local-data-api_1  |     at java.base/sun.nio.ch.Net.bind0(Native Method)
local-data-api_1  |     at java.base/sun.nio.ch.Net.bind(Unknown Source)
local-data-api_1  |     at java.base/sun.nio.ch.Net.bind(Unknown Source)
local-data-api_1  |     at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
local-data-api_1  |     at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
local-data-api_1  |     at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550)
local-data-api_1  |     at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
local-data-api_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
local-data-api_1  |     at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
local-data-api_1  |     at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
local-data-api_1  |     at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248)
local-data-api_1  |     at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
local-data-api_1  |     at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
local-data-api_1  |     at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
local-data-api_1  |     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
local-data-api_1  |     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
local-data-api_1  |     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
local-data-api_1  |     at io.ktor.server.netty.EventLoopGroupProxy$Companion$create$factory$1$1.run(NettyApplicationEngine.kt:227)
local-data-api_1  |     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
local-data-api_1  |     at java.base/java.lang.Thread.run(Unknown Source)

To Reproduce Steps to reproduce the behavior:

  1. Git clone this project
  2. Use docker-compose to start it docker-compose -f docker-compose-postgres.yml up
  3. Here is docker-compose-postgres.yml content

services:
  local-data-api:
    image: koxudaxi/local-data-api
    restart: always
    environment:
      ENGINE: PostgreSQLJDBC
      POSTGRES_HOST: db
      POSTGRES_PORT: 5432
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: example
      RESOURCE_ARN: 'arn:aws:rds:us-east-1:123456789012:cluster:dummy'
      SECRET_ARN: 'arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy'
    ports:
      - "8080:80"
  db:
    image: postgres:10.7-alpine
    restart: always
    environment:
      POSTGRES_PASSWORD: example
      POSTGRES_DB: test
    ports:
        - "5435:5432"
  1. See error

** Environment

  • OS: CentOS Linux release 7.6.1810
  • Docker: Docker version 20.10.5, build 55c4c88/docker-compose version 1.23.2, build 1110ad01
  • Version 0.6.6

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
filipsukcommented, Apr 25, 2021

I had this permission problem in gitlab CI pipelines with v0.6.4. Upgrading to v0.6.10 helped. Thanks! 🚀

2reactions
dtvuongcommented, Apr 11, 2021

@koxudaxi Thanks for your response. I tried with your suggestion and the “Permission denied” error no longer appears but I still cannot access to local data-api. I guess have something wrong with my docker installation. I will check and respond to you later.

どうもありがとうございます。

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bind failed - java.net.SocketException: Permission denied
When I startup the server with the Wowza Startup app all requested ports are bound except port 80 with the Permission denied warning....
Read more >
Openshift java.net.SocketException: Permission denied
I was trying to find out solution. I have got some solutions. All are suggesting to add -Djava.net.preferIPv4Stack=true to the VM options.
Read more >
java.net.SocketException: Permission denied: connect
I'm constantly seeing the error "java.net.SocketException: Permission denied: connect" in my Alerts tab for all the domains that I'm testing ...
Read more >
Server fails to start with exception java.net.SocketException
Cause. It appears that in some specific environments, you need to set a JVM flag to specify that you are using the IPV4...
Read more >
java.net.SocketException: Permission denied - Kontext
When trying to start Hadoop DFS services in WSL (Windows Subsystem for Linux), it failed with the following error: 2021-01-01 21:13:37650 INFO ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found