Cant open Website after adding Security functionality - vaadin

im using the latest version of Vaadin.
I upgraded my 3 Months old project to the latest version.
Also implemented the default login system by the vaadin start generator.
But know when the Fontend gets buid following error accurs:
Vaadin is running in DEVELOPMENT mode - do not use for production deployments.
2023-01-05 19:40:37.742 INFO 51916 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-01-05 19:40:37.759 INFO 51916 --- [ restartedMain] de.admin.commgr.Application : Started Application in 5.716 seconds (JVM running for 6.395)
2023-01-05 19:40:47.100 INFO 51916 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-01-05 19:40:47.100 INFO 51916 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2023-01-05 19:40:47.102 INFO 51916 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
2023-01-05 19:40:47.168 INFO 51916 --- [nio-8080-exec-2] c.vaadin.flow.spring.SpringInstantiator : The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior
npm WARN deprecated stable#0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated rollup-plugin-terser#7.0.2: This package has been deprecated and is no longer maintained. Please use #rollup/plugin-terser
npm WARN deprecated sourcemap-codec#1.4.8: Please use #jridgewell/sourcemap-codec instead
npm WARN deprecated svgo#1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
2023-01-05 19:42:40.395 INFO 51916 --- [onPool-worker-1] c.v.f.s.frontend.TaskUpdatePackages : Frontend dependencies resolved successfully.
2023-01-05 19:42:42.484 INFO 51916 --- [onPool-worker-1] c.v.f.s.frontend.TaskCopyFrontendFiles : Copying frontend resources from jar files ...
2023-01-05 19:42:42.512 INFO 51916 --- [onPool-worker-1] c.v.f.s.frontend.TaskCopyFrontendFiles : Visited 23 resources. Took 27 ms.
2023-01-05 19:42:42.544 INFO 51916 --- [onPool-worker-1] c.v.f.server.frontend.TaskUpdateImports :
Failed to find the following imports in the `node_modules` tree:
- #vaadin/flow-frontend/comboBoxConnector.js
- #vaadin/flow-frontend/contextMenuTargetConnector.js
- #vaadin/flow-frontend/messageListConnector.js
- #vaadin/flow-frontend/ironListStyles.js
- #vaadin/flow-frontend/notificationConnector.js
- #vaadin/flow-frontend/selectConnector.js
- #vaadin/flow-frontend/lit-renderer.ts
- #vaadin/flow-frontend/lumo-includes.ts
- #vaadin/flow-frontend/vaadin-big-decimal-field.js
- #vaadin/flow-frontend/contextMenuConnector.js
- #vaadin/flow-frontend/dndConnector-es6.js
- #vaadin/flow-frontend/menubarConnector.js
- #vaadin/flow-frontend/vaadin-grid-flow-selection-column.js
- #vaadin/flow-frontend/virtualListConnector.js
- #vaadin/flow-frontend/cookieConsentConnector.js
- #vaadin/flow-frontend/datepickerConnector.js
- #vaadin/flow-frontend/vaadin-map/mapConnector.js
- #vaadin/flow-frontend/ironListConnector.js
- #vaadin/flow-frontend/vaadin-time-picker/timepickerConnector.js
- #vaadin/flow-frontend/loginOverlayConnector.js
- #vaadin/flow-frontend/dialogConnector.js
- #vaadin/flow-frontend/gridProConnector.js
- #vaadin/flow-frontend/gridConnector.js
- #vaadin/flow-frontend/flow-component-renderer.js
- #vaadin/flow-frontend/confirmDialogConnector.js
If the build fails, check that npm packages are installed.
To fix the build remove `package-lock.json` and `node_modules` directory to reset modules.
In addition you may run `npm install` to fix `node_modules` tree structure.
2023-01-05 19:42:42.546 INFO 51916 --- [onPool-worker-1] c.v.b.devserver.AbstractDevServerRunner : Starting Vite
------------------ Starting Frontend compilation. ------------------
2023-01-05 19:42:44.816 INFO 51916 --- [onPool-worker-1] c.v.b.devserver.AbstractDevServerRunner : Running Vite to compile frontend resources. This may take a moment, please stand by...
2023-01-05 19:42:46.071 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : Searching themes folder '/Users/admin/Documents/Development/Projects/test-manager/frontend/themes' for theme 'testmanager'
2023-01-05 19:42:46.072 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : no assets to handle no static assets were copied
2023-01-05 19:42:46.075 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : Found theme files from '/Users/admin/Documents/Development/Projects/test-manager/frontend/themes'
2023-01-05 19:42:46.718 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2023-01-05 19:42:46.719 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : VITE v3.1.0 ready in 1832 ms
----------------- Frontend compiled successfully. -----------------
2023-01-05 19:42:46.719 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2023-01-05 19:42:46.719 INFO 51916 --- [onPool-worker-1] c.v.b.devserver.AbstractDevServerRunner : Started Vite. Time: 4173ms
2023-01-05 19:42:46.719 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : ➜ Local: http://127.0.0.1:50554/VAADIN/
2023-01-05 19:42:48.056 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2023-01-05 19:42:48.057 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : ERROR(TypeScript) Cannot find module '#vaadin/flow-frontend/Flow' or its corresponding type declarations.
2023-01-05 19:42:48.057 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : FILE /Users/admin/Documents/Development/Projects/test-manager/frontend/generated/index.ts:17:22
2023-01-05 19:42:48.057 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2023-01-05 19:42:48.058 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 15 |
2023-01-05 19:42:48.058 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 16 | // import Flow module to enable navigation to Vaadin server-side views
2023-01-05 19:42:48.058 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : > 17 | import { Flow } from '#vaadin/flow-frontend/Flow';
2023-01-05 19:42:48.058 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-01-05 19:42:48.058 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 18 |
2023-01-05 19:42:48.058 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 19 | const { serverSideRoutes } = new Flow({
2023-01-05 19:42:48.058 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 20 | imports: () => import('../../target/frontend/generated-flow-imports')
2023-01-05 19:42:48.059 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2023-01-05 19:42:48.059 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [TypeScript] Found 1 error. Watching for file changes.
2023-01-05 19:42:51.098 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] Internal server error: Failed to resolve import "#vaadin/flow-frontend/vaadin-dev-tools.js" from "frontend/generated/vaadin.ts". Does the file exist?
2023-01-05 19:42:51.098 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : Plugin: vite:import-analysis
2023-01-05 19:42:51.098 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : File: /Users/admin/Documents/Development/Projects/test-manager/frontend/generated/vaadin.ts
2023-01-05 19:42:51.098 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 1 | import "./vaadin-featureflags.ts";
2023-01-05 19:42:51.098 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 2 | import "./index";
2023-01-05 19:42:51.098 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 3 | import "#vaadin/flow-frontend/vaadin-dev-tools.js";
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : | ^
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 4 | import { applyTheme } from "./theme";
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 5 | applyTheme(document);
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : at formatError (file:///Users/admin/Documents/Development/Projects/test-manager/node_modules/vite/dist/node/chunks/dep-665b0112.js:40782:46)
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : at TransformContext.error (file:///Users/admin/Documents/Development/Projects/test-manager/node_modules/vite/dist/node/chunks/dep-665b0112.js:40778:19)
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : at normalizeUrl (file:///Users/admin/Documents/Development/Projects/test-manager/node_modules/vite/dist/node/chunks/dep-665b0112.js:37514:33)
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-01-05 19:42:51.099 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : at async TransformContext.transform (file:///Users/admin/Documents/Development/Projects/test-manager/node_modules/vite/dist/node/chunks/dep-665b0112.js:37648:47)
2023-01-05 19:42:51.100 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : at async Object.transform (file:///Users/admin/Documents/Development/Projects/test-manager/node_modules/vite/dist/node/chunks/dep-665b0112.js:41031:30)
2023-01-05 19:42:51.100 INFO 51916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : at async loadAndTransform (file:///Users/admin/Documents/Development/Projects/test-manager/node_modules/vite/dist/node/chunks/dep-665b0112.js:37292:29)
These are my POM Versions:
<properties>
<java.version>11</java.version>
<vaadin.version>23.3.2</vaadin.version>
<selenium.version>4.5.3</selenium.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
</parent>
I already tried using no vpn, disabling pihole for downloading the npm modules, frontend cleanup and so on and so on.

Are you upgrading from a previous Vaadin 23 version?
Try running this Maven goal and then run your project again: mvn clean vaadin:clean-frontend

Related

Docker containers running on the server are not visible in the netdata dashboard

ı installed netdata on my server and connected it to the netdata dashboard, but I noticed that I cannot see the Docker containers that are currently running on the server on the dashboard. To fix this, I updated the compose.yml file with the following volumes section:
netdata:
image: netdata/netdata
++pid:"host"
container_name: netdata
hostname: example.com # set to fqdn of host
ports:
- 19999:19999
restart: unless-stopped
cap_add:
- SYS_PTRACE
security_opt:
- apparmor:unconfined
volumes:
- netdataconfig:/etc/netdata
- netdatalib:/var/lib/netdata
- netdatacache:/var/cache/netdata
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /etc/os-release:/host/etc/os-release:ro
- /sys/fs/cgroup:/host/sys/fs/cgroup:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /user-service:/host/user-service:ro
and then I restarted the container. However, when I checked the logs of the netdata container, I saw the following error:
2023-01-05 10:08:38: cgroup-name.sh: INFO: docker container
'7d6a282fefd31f1df1b89cc234ba1266278a09f61280f8b3bb707dd79f9fb46e' is named 'notification-service'
2023-01-05 10:08:38: cgroup-name.sh: INFO: cgroup 'system.slice_docker-7d6a282fefd31f1df1b89cc234ba1266278a09f61280f8b3bb707dd79f9fb46e.scope' is called 'notification-service'
2023-01-05 10:08:39: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : Using host prefix directory '/host'
2023-01-05 10:08:39: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot open pid_from_cgroup() file '/host/sys/fs/cgroup/system.slice/docker-7d6a282fefd31f1df1b89cc234ba1266278a09f61280f8b3bb707dd79f9fb46e.scope/tasks'. (errno 2, No such file or directory)
2023-01-05 10:08:39: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : running: exec /usr/libexec/netdata/plugins.d/cgroup-network-helper.sh --cgroup '/host/sys/fs/cgroup/system.slice/docker-7d6a282fefd31f1df1b89cc234ba1266278a09f61280f8b3bb707dd79f9fb46e.scope'
2023-01-05 10:08:39: cgroup-network-helper.sh: INFO: searching for network interfaces of cgroup '/host/sys/fs/cgroup/system.slice/docker-7d6a282fefd31f1df1b89cc234ba1266278a09f61280f8b3bb707dd79f9fb46e.scope'
When I go to the bash of the netdata container, the file path /host/sys/fs/cgroup/system.slice/docker-7d6a282fefd31f1df1bs89cc234ba1sd266278a0s9f61280f8b3bb707dd79f9fb46e.scope
actually exists. But there is no file named tasks in this file path.
How can I solve this error and see every container running on the server on the dashboard?
I solved the above error by adding the pid line, but I still can't see the containers running on the server on the dashboard. netdata container logs as follows:
2023-01-05 12:43:35: cgroup-name.sh: INFO: cgroup 'init.scope' is called 'init.scope'
2023-01-05 12:43:35: cgroup-name.sh: INFO: Running API command: curl --unix-socket "/var/run/docker.sock" http://localhost/containers/d1e758ed14c0e33d53f1a6467daebb715db468818fb77e5cb1c194ad6a890928/json
2023-01-05 12:43:35: cgroup-name.sh: INFO: docker container 'd1e758ed14c0e33d53f1a6467daebb715db468818fb77e5cb1c194ad6a890928' is named 'definition-service'
2023-01-05 12:43:35: cgroup-name.sh: INFO: cgroup 'system.slice_docker-d1e758ed14c0e33d53f1a6467daebb715db468818fb77e5cb1c194ad6a890928.scope' is called 'definition-service'
2023-01-05 12:43:36: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : Using host prefix directory '/host'
2023-01-05 12:43:36: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : running: exec /usr/libexec/netdata/plugins.d/cgroup-network-helper.sh --cgroup '/host/sys/fs/cgroup/system.slice/docker-d1e758ed14c0e33d53f1a6467daebb715db468818fb77e5cb1c194ad6a890928.scope'
2023-01-05 12:43:37: cgroup-network-helper.sh: INFO: searching for network interfaces of cgroup '/host/sys/fs/cgroup/system.slice/docker-d1e758ed14c0e33d53f1a6467daebb715db468818fb77e5cb1c194ad6a890928.scope'
2023-01-05 12:43:37: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : child pid 1853221 exited with code 1.
2023-01-05 12:43:37: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to network namespace of pid 1342633 (errno 1, Operation not permitted)
2023-01-05 12:43:37: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to pid namespace of pid 1342633 (errno 1, Operation not permitted)
2023-01-05 12:43:37: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to mount namespace of pid 1342633 (errno 1, Operation not permitted)
2023-01-05 12:43:37: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : PROCFILE: Cannot open file '/proc/net/dev' (errno 2, No such file or directory)
2023-01-05 12:43:37: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot open file '/proc/net/dev'
2023-01-05 12:43:37: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : cannot read cgroup interface list.
2023-01-05 12:43:37: cgroup-name.sh: INFO: Running API command: curl --unix-socket "/var/run/docker.sock" http://localhost/containers/459c9a2f6634443c1a0931d55628c60c6a268c9303052171cf4771ae88a340ad/json
2023-01-05 12:43:37: cgroup-name.sh: INFO: docker container '459c9a2f6634443c1a0931d55628c60c6a268c9303052171cf4771ae88a340ad' is named 'mongo_db'
2023-01-05 12:43:37: cgroup-name.sh: INFO: cgroup 'system.slice_docker-459c9a2f6634443c1a0931d55628c60c6a268c9303052171cf4771ae88a340ad.scope' is called 'mongo_db'
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : Using host prefix directory '/host'
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : running: exec /usr/libexec/netdata/plugins.d/cgroup-network-helper.sh --cgroup '/host/sys/fs/cgroup/system.slice/docker-459c9a2f6634443c1a0931d55628c60c6a268c9303052171cf4771ae88a340ad.scope'
2023-01-05 12:43:38: ACLK STA [30c26177-2ef2-4768-b509-6e58e18e2643 (example.com)]: QUEUED REMOVED ALERTS
2023-01-05 12:43:38: cgroup-network-helper.sh: INFO: searching for network interfaces of cgroup '/host/sys/fs/cgroup/system.slice/docker-459c9a2f6634443c1a0931d55628c60c6a268c9303052171cf4771ae88a340ad.scope'
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : child pid 1853268 exited with code 1.
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to network namespace of pid 1343129 (errno 1, Operation not permitted)
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to pid namespace of pid 1343129 (errno 1, Operation not permitted)
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to mount namespace of pid 1343129 (errno 1, Operation not permitted)
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : PROCFILE: Cannot open file '/proc/net/dev' (errno 2, No such file or directory)
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot open file '/proc/net/dev'
2023-01-05 12:43:38: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : cannot read cgroup interface list.
2023-01-05 12:43:39: cgroup-name.sh: INFO: Running API command: curl --unix-socket "/var/run/docker.sock" http://localhost/containers/ee448a793745d2a72ed86fbcb26baa7de16f7103a816910684ad457b6557e179/json
2023-01-05 12:43:39: cgroup-name.sh: INFO: docker container 'ee448a793745d2a72ed86fbcb26baa7de16f7103a816910684ad457b6557e179' is named 'mail-service'
2023-01-05 12:43:39: cgroup-name.sh: INFO: cgroup 'system.slice_docker-ee448a793745d2a72ed86fbcb26baa7de16f7103a816910684ad457b6557e179.scope' is called 'mail-service'
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : Using host prefix directory '/host'
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network INFO : MAIN : running: exec /usr/libexec/netdata/plugins.d/cgroup-network-helper.sh --cgroup '/host/sys/fs/cgroup/system.slice/docker-ee448a793745d2a72ed86fbcb26baa7de16f7103a816910684ad457b6557e179.scope'
2023-01-05 12:43:40: cgroup-network-helper.sh: INFO: searching for network interfaces of cgroup '/host/sys/fs/cgroup/system.slice/docker-ee448a793745d2a72ed86fbcb26baa7de16f7103a816910684ad457b6557e179.scope'
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : child pid 1853317 exited with code 1.
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to network namespace of pid 1499298 (errno 1, Operation not permitted)
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to pid namespace of pid 1499298 (errno 1, Operation not permitted)
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot switch to mount namespace of pid 1499298 (errno 1, Operation not permitted)
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : PROCFILE: Cannot open file '/proc/net/dev' (errno 2, No such file or directory)
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : Cannot open file '/proc/net/dev'
2023-01-05 12:43:40: /usr/libexec/netdata/plugins.d/cgroup-network ERROR : MAIN : cannot read cgroup interface list.
2023-01-05 12:43:41: cgroup-name.sh: INFO: Running API command: curl --unix-socket "/var/run/docker.sock" http://localhost/containers/bcb761b2cd1e89d530cc8973ed21a894e21bc50d0d7138eb8605705ba4ea7b32/json
2023-01-05 12:43:41: cgroup-name.sh: INFO: docker container 'bcb761b2cd1e89d530cc8973ed21a894e21bc50d0d7138eb8605705ba4ea7b32' is named 'netdata'
2023-01-05 12:43:41: cgroup-name.sh: INFO: cgroup 'system.slice_docker-bcb761b2cd1e89d530cc8973ed21a894e21bc50d0d7138eb8605705ba4ea7b32.scope' is called 'netdata'
I saw this similar issue https://github.com/netdata/netdata/issues/11069 and the fix seemed to be to add pid: "host", check this comment
https://github.com/netdata/netdata/issues/11069#issuecomment-952228202
Can you try and see if it works?

Docker not connecting to port

When I run the command:
docker run -d -p 8080:3100 username/sb-dockerized
and go to localhost:8080, it doesn't connect. Says "This page isn't working"
In my Dockerfile I am exposing port 3100
EXPOSE 3100
Logs
2021-07-10 15:53:27.828 INFO 1 --- [ main] c.e.s.SpringBootDockerizedApplication : Starting SpringBootDockerizedApplication v0.0.1-SNAPSHOT using Java 15.0.1 on d3b451475e8d with PID 1 (/clancinio/lib/sb-dockerized.jar started by root in /clancinio/lib)
2021-07-10 15:53:27.832 INFO 1 --- [ main] c.e.s.SpringBootDockerizedApplication : No active profile set, falling back to default profiles: default
2021-07-10 15:53:29.556 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-07-10 15:53:29.579 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-07-10 15:53:29.579 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.48]
2021-07-10 15:53:29.679 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-07-10 15:53:29.679 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1755 ms
2021-07-10 15:53:30.300 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-07-10 15:53:30.316 INFO 1 --- [ main] c.e.s.SpringBootDockerizedApplication : Started SpringBootDockerizedApplication in 3.173 seconds (JVM running for 3.872)
Any idea of what could be going wrong?
In your Dockerfile, EXPOSE 8080 because your spring-boot app is listening to that port inside your container. While running, run with docker run -d -p <<the port you want to hit in the url>>:8080 username/sb-dockerized and then access http://localhost:<<the port you want to hit in the url>>
From your browser navigate to http://<hostIP>:8080

503 status in case of starting spring configuration server via docker-compose

I've created demo configuration server using spring boot. It works fine.
$ curl GET http://localhost:9090/actuator/health
curl: (6) Could not resolve host: GET
{"status":"UP"}%
I use as parent project
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
dependencies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Next step is to wrap the service via docker. Dockerfile is:
FROM java:8-jre
VOLUME /tmp
ADD target/*.jar app.jar
ENV JAVA_OPTS="-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode"
ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar
EXPOSE 9090
Creating independent docker image and starting container it works like expected:
$ docker build .
>> ... <imageName>
$ docker run -p 9090:9090 <imageName>
Creating docker-compose.yml:
version: '3.3'
services:
config-server:
build: config-server
ports:
- "9090:9090"
expose:
- "9090"
networks:
- "my-network"
networks:
my-network:
Starting and checking result:
$ docker-compose up -d
$ curl GET http://localhost:9090/actuator/health
curl: (6) Could not resolve host: GET
{"status":"DOWN"}%
Log trace looks ok:
OpenJDK 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
2018-07-13 14:00:23.804 INFO 7 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#6fadae5d: startup date [Fri Jul 13 14:00:23 UTC 2018]; root of context hierarchy
2018-07-13 14:00:24.409 INFO 7 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a6513cca] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.3.RELEASE)
2018-07-13 14:00:24.774 INFO 7 --- [ main] e.m.c.ConfigServerApplication : The following profiles are active: docker
2018-07-13 14:00:24.792 INFO 7 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#5b87ed94: startup date [Fri Jul 13 14:00:24 UTC 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#6fadae5d
2018-07-13 14:00:25.866 INFO 7 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=68ad2e34-6263-3fe6-b377-5579821a13f0
2018-07-13 14:00:25.954 INFO 7 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a6513cca] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-07-13 14:00:26.335 INFO 7 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9090 (http)
2018-07-13 14:00:26.393 INFO 7 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-07-13 14:00:26.393 INFO 7 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.31
2018-07-13 14:00:26.413 INFO 7 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
2018-07-13 14:00:26.560 INFO 7 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-07-13 14:00:26.561 INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1768 ms
2018-07-13 14:00:28.187 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-07-13 14:00:28.194 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-07-13 14:00:28.195 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-07-13 14:00:28.195 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-07-13 14:00:28.196 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-07-13 14:00:28.196 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2018-07-13 14:00:28.196 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2018-07-13 14:00:28.482 INFO 7 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-13 14:00:28.771 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#5b87ed94: startup date [Fri Jul 13 14:00:24 UTC 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#6fadae5d
2018-07-13 14:00:28.907 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-07-13 14:00:28.909 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-07-13 14:00:28.922 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/encrypt],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.encrypt(java.lang.String,org.springframework.http.MediaType)
2018-07-13 14:00:28.923 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/encrypt/{name}/{profiles}],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.encrypt(java.lang.String,java.lang.String,java.lang.String,org.springframework.http.MediaType)
2018-07-13 14:00:28.923 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/decrypt/{name}/{profiles}],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.decrypt(java.lang.String,java.lang.String,java.lang.String,org.springframework.http.MediaType)
2018-07-13 14:00:28.923 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/decrypt],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.decrypt(java.lang.String,org.springframework.http.MediaType)
2018-07-13 14:00:28.924 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/encrypt/status],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.config.server.encryption.EncryptionController.status()
2018-07-13 14:00:28.924 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/key],methods=[GET]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.getPublicKey()
2018-07-13 14:00:28.924 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/key/{name}/{profiles}],methods=[GET]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.getPublicKey(java.lang.String,java.lang.String)
2018-07-13 14:00:28.935 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}-{profiles}.properties],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.properties(java.lang.String,java.lang.String,boolean) throws java.io.IOException
2018-07-13 14:00:28.936 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{label}/{name}-{profiles}.json],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.labelledJsonProperties(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2018-07-13 14:00:28.936 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profiles:.*[^-].*}],methods=[GET]}" onto public org.springframework.cloud.config.environment.Environment org.springframework.cloud.config.server.environment.EnvironmentController.defaultLabel(java.lang.String,java.lang.String)
2018-07-13 14:00:28.937 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}-{profiles}.yml || /{name}-{profiles}.yaml],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.yaml(java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2018-07-13 14:00:28.937 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profiles}/{label:.*}],methods=[GET]}" onto public org.springframework.cloud.config.environment.Environment org.springframework.cloud.config.server.environment.EnvironmentController.labelled(java.lang.String,java.lang.String,java.lang.String)
2018-07-13 14:00:28.937 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}-{profiles}.json],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.jsonProperties(java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2018-07-13 14:00:28.938 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{label}/{name}-{profiles}.properties],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.labelledProperties(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.io.IOException
2018-07-13 14:00:28.938 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{label}/{name}-{profiles}.yml || /{label}/{name}-{profiles}.yaml],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.labelledYaml(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2018-07-13 14:00:28.944 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profile}/**],methods=[GET],params=[useDefaultLabel]}" onto public java.lang.String org.springframework.cloud.config.server.resource.ResourceController.retrieve(java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest,boolean) throws java.io.IOException
2018-07-13 14:00:28.944 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profile}/{label}/**],methods=[GET]}" onto public java.lang.String org.springframework.cloud.config.server.resource.ResourceController.retrieve(java.lang.String,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest,boolean) throws java.io.IOException
2018-07-13 14:00:28.944 INFO 7 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profile}/{label}/**],methods=[GET],produces=[application/octet-stream]}" onto public synchronized byte[] org.springframework.cloud.config.server.resource.ResourceController.binary(java.lang.String,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2018-07-13 14:00:28.986 INFO 7 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-13 14:00:28.987 INFO 7 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-13 14:00:29.666 INFO 7 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2018-07-13 14:00:29.683 INFO 7 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-07-13 14:00:29.684 INFO 7 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-07-13 14:00:29.686 INFO 7 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-07-13 14:00:29.755 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-07-13 14:00:29.766 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'environmentManager' has been autodetected for JMX exposure
2018-07-13 14:00:29.768 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2018-07-13 14:00:29.769 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'refreshScope' has been autodetected for JMX exposure
2018-07-13 14:00:29.772 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2018-07-13 14:00:29.789 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2018-07-13 14:00:29.819 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=5b87ed94,type=ConfigurationPropertiesRebinder]
2018-07-13 14:00:29.925 INFO 7 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9090 (http) with context path ''
2018-07-13 14:00:29.931 INFO 7 --- [ main] e.m.c.ConfigServerApplication : Started ConfigServerApplication in 7.179 seconds (JVM running for 7.857)
2018-07-13 14:00:34.931 INFO 7 --- [nio-9090-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-07-13 14:00:34.932 INFO 7 --- [nio-9090-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-07-13 14:00:34.965 INFO 7 --- [nio-9090-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 33 ms
Is any idea how to fix health status of the service that is started in docker-compose?
Every time I started containers, they were created successfully. They were dropped also successfully directly, before starting new ones. Last time I used instruction:
docker-compose down
to drop containers managed by docker-compose in automatic way.
That seems clear.
...But! The issue was in already created images. And images was not updated. To confirm my assumption I dropped correspond image and every thing was fixed. To make it in automatic way I've detected docker-compose additional useful flags and I use now:
docker-compose down --rmi local
--rmi means drop all images on which were based containers.
local Remove only images that don't have a custom tag set by the image field (it is non internet loaded images for usual cases).

Error while running docker image for springboot project

I have a springboot project with spring data jpa
My application.properties looks like
spring.datasource.url=jdbc:mysql://localhost:3306/db1
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
It runs without an error when i run with maven "mvn spring-boot:run"
I created a docker image for the project and tried to run it
docker run springbootdemo //springbootdemo is the docker image name
While running the image i am getting the below error:
2018-07-16 12:12:04.879 INFO 1 --- [ main] c.s.S.SpringBootDemoApplication : Starting SpringBootDemoApplication v0.0.1-SNAPSHOT on fa7cd1e82e95 with PID 1 (/springDocker.war started by root in /)
2018-07-16 12:12:04.882 INFO 1 --- [ main] c.s.S.SpringBootDemoApplication : No active profile set, falling back to default profiles: default
2018-07-16 12:12:04.939 INFO 1 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#38cccef: startup date [Mon Jul 16 12:12:04 GMT 2018]; root of context hierarchy
2018-07-16 12:12:06.145 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$582af4bf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-07-16 12:12:06.470 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-07-16 12:12:06.496 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-07-16 12:12:06.496 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.10
2018-07-16 12:12:06.509 INFO 1 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2018-07-16 12:12:06.582 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-07-16 12:12:06.582 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1646 ms
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2018-07-16 12:12:07.030 INFO 1 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-07-16 12:12:07.033 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-07-16 12:12:07.033 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-07-16 12:12:07.033 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-07-16 12:12:07.034 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-07-16 12:12:07.034 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2018-07-16 12:12:07.034 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2018-07-16 12:12:07.111 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-07-16 12:12:07.115 WARN 1 --- [ main] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2018-07-16 12:12:08.224 ERROR 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:172) ~[mysql-connector-java-8.0.11.jar!/:8.0.11]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.11.jar!/:8.0.11]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:862) ~[mysql-connector-java-8.0.11.jar!/:8.0.11]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:444) ~[mysql-connector-java-8.0.11.jar!/:8.0.11]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:230) ~[mysql-connector-java-8.0.11.jar!/:8.0.11]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:226) ~[mysql-connector-java-8.0.11.jar!/:8.0.11]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136) ~[HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369) ~[HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198) ~[HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467) [HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541) [HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) [HikariCP-3.2.0.jar!/:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) [HikariCP-3.2.0.jar!/:na]
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:151) [spring-jdbc-5.1.0.BUILD-SNAPSHOT.jar!/:5.1.0.BUILD-SNAPSHOT]
Any help would be appreciated. Thanks in advance !!
When you are inside of a Docker container, the localhost resolves to container IP address. But your Database is not in your application Docker container.
So you should change spring.datasource.url configuration to a URL that is real database IP address accessible from your application Docker container. Change the localhost in spring.datasource.url to Docker host IP address or your LAN IP address.
Also I think it's better that you specify an environment variable in your Docker file that points to the Database IP address and use that in your configuration properties.

Accessing local Postgres DB from inside the SpringBoot Docker Container

I have a springboot app that accesses my localhost:5432 postgress database
I have dockerised it and want to connect to the database from docker container
Running the container like this
docker run -p 8080:8080 risk-assesment:v1
i get the below error
2018-03-22 20:29:34.105 INFO 7 --- [ main] c.c.h.r.RiskAssessmentApplication : The following profiles are active: local
2018-03-22 20:29:34.180 INFO 7 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#2ac1fdc4: startup date [Thu Mar 22 20:29:34 CDT 2018]; root of context hierarchy
2018-03-22 20:29:36.568 INFO 7 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-03-22 20:29:36.838 INFO 7 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$af64b9d0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-03-22 20:29:37.516 INFO 7 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9000 (http)
2018-03-22 20:29:37.570 INFO 7 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-03-22 20:29:37.571 INFO 7 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.28
2018-03-22 20:29:37.595 INFO 7 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2018-03-22 20:29:37.754 INFO 7 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-03-22 20:29:37.755 INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3578 ms
2018-03-22 20:29:39.215 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-03-22 20:29:39.224 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-03-22 20:29:39.226 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-03-22 20:29:39.226 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-03-22 20:29:39.227 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-03-22 20:29:39.227 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2018-03-22 20:29:39.228 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2018-03-22 20:29:39.538 INFO 7 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-03-22 20:29:39.625 WARN 7 --- [ main] unknown.jul.logger : ConnectException occurred while connecting to localhost:5432
If you are on a mac instead of localhost:5432 use this to connect to your machine from inside docker container.
docker.for.mac.localhost:5432
If this dosn't work
Get inside the docker container
docker exec -it yourcontainername /bin/bash
Get your host ip address
netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}'
In your springboot aplication use this ip instead of localhost.

Resources