the digs do not work in the frontend, the frontend shows but does not work, the port of the frontend is react localhost:3000 of the backend node.js localhost:5000
here docker-compose.yml
The connection error log came before the database was initialized. Your backend needs to wait until the database actually starts or need to be able to retry. That can happen if your restart policy is “always”, but you only added that to mysql.
The log doesn’t help me understand if the a backend container really restarted. Can you share a long enough log that shows that the mysql server started successfully, listening on its port and the backend fails after that?
At the same time, can you confirm that I see an IP address in the logs because nodejs resolves “mysql” to the container IP and shows that in the log?
According to the logs mysql is only ready for connections after your last shared logs in the backend containrs shows it already failed connecting to mysql and I see no new logs showing it restarted.
So I still don’t see anything special here. The only log after the mysql logs are frontend logs
Are you sure the backend is restarting? What does docker compsoe ps show after MySQL already started?
I changed it to in docker-compose.yml host on ports:
- “127.0.0.1:3306:3306” and sequelize created tables in the database, but the site buttons still don’t respond
writes
ℹ 「wds」: Project is running at http://172.18.0.3/
frontend-1 | ℹ 「wds」: webpack output is served from
frontend-1 | ℹ 「wds」: Content not from webpack is served from /app/public
frontend-1 | ℹ 「wds」: 404s will fallback to /
frontend-1 | Starting the development server...
frontend-1 |
frontend-1 | Browserslist: caniuse-lite is outdated. Please run:
frontend-1 | npx browserslist@latest --update-db
frontend-1 |
frontend-1 | Why you should do it regularly:
frontend-1 | https://github.com/browserslist/browserslist#browsers-data-updating
frontend-1 | Compiled with warnings.
frontend-1 |
frontend-1 | src/App.js
frontend-1 | Line 1:16: 'FC' is defined but never used no-unused-vars
frontend-1 | Line 15:8: React Hook useEffect has a missing dependency: 'store'. Either include it or remove the dependency array react-hooks/exhaustive-deps
frontend-1 |
frontend-1 | src/components/LoginForm.js
frontend-1 | Line 1:16: 'FC' is defined but never used no-unused-vars
frontend-1 |
frontend-1 | src/http/index.js
frontend-1 | Line 20:31: Expected '===' and instead saw '==' eqeqeq
frontend-1 |
frontend-1 | src/store/store.js
frontend-1 | Line 53:19: 'response' is assigned a value but never used no-unused-vars
frontend-1 |
frontend-1 | Search for the keywords to learn more about each warning.
frontend-1 | To ignore, add // eslint-disable-next-line to the line before.
frontend-1 |
although my site runs in localhost:3333 how do I change it so that the site runs on localhost?
I’m confused. Evey time I think I understand what you do, your next comment shows something I can’t explain.
For example, there is no way that binding the port to a loopback interface solves connection issues from another container. That could only allow accessing the MySQL server from the host, not from other containers.
Do you mean the app in the container listens on localhost and you can’t access it from the host?
You will need to be more precise. There are issues that would require the same debugging process wihtout containers, like why a button in the webbrowser don’t respond. You can check the developer console in the browser. It seems you try to solve multiple problems at the same time and I don’t know which one is which.
I hope someone else will look at this topic too, because I feel I can’t follow the issue.
localhos:3333 i mean frontend
I do not know at the moment sequelize created Tables in the database when i added 127.0.0.1 before 3306:3306 ports in mysql service in docker-compose.yml. I changed the docker site(site 100% working, i tested it before run on docker), and docker again it gives an error
here docker-compose.yml
I did not change the dockerfiles in the frontend and backend
here error
PS C:\docker\reactApp> docker compose up w Enable Watch d Detach
[+] up 1/1
✔ Container reactapp-mysql-1 Recreated 0.8s
Attaching to adminer-1, backend-1, frontend-1, mysql-1
mysql-1 | 2026-02-25 21:23:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.8-1.el9 started.
adminer-1 | [Wed Feb 25 21:23:36 2026] PHP 8.4.18 Development Server (http://[::]:8080) started
mysql-1 | 2026-02-25 21:23:36+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mysql-1 | 2026-02-25 21:23:36+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.8-1.el9 started.
frontend-1 |
frontend-1 | > client@0.1.0 start
frontend-1 | > react-scripts start
frontend-1 |
backend-1 |
backend-1 | > server@1.0.0 dev
backend-1 | > nodemon index.js
backend-1 |
mysql-1 | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
backend-1 | [nodemon] 2.0.7
backend-1 | [nodemon] to restart at any time, enter `rs`
backend-1 | [nodemon] watching path(s): *.*
backend-1 | [nodemon] watching extensions: js,mjs,json
backend-1 | [nodemon] starting `node index.js`
mysql-1 | 2026-02-25T21:23:37.957241Z 0 [System] [MY-015015] [Server] MySQL Server - start.
mysql-1 | 2026-02-25T21:23:39.034201Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.8) starting as process 1
mysql-1 | 2026-02-25T21:23:39.080281Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
mysql-1 | 2026-02-25T21:23:40.431784Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysql-1 | 2026-02-25T21:23:41.313430Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
mysql-1 | 2026-02-25T21:23:41.313633Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
mysql-1 | 2026-02-25T21:23:41.336098Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
backend-1 | ConnectionRefusedError [SequelizeConnectionRefusedError]: connect ECONNREFUSED 172.18.0.2:3306
backend-1 | at ConnectionManager.connect (/app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:116:17)
backend-1 | at processTicksAndRejections (node:internal/process/task_queues:96:5)
backend-1 | at async ConnectionManager._connect (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:318:24)
backend-1 | at async /app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:250:32
backend-1 | at async ConnectionManager.getConnection (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:280:7)
backend-1 | at async /app/node_modules/sequelize/lib/sequelize.js:613:26
backend-1 | at async Sequelize.authenticate (/app/node_modules/sequelize/lib/sequelize.js:867:5)
backend-1 | at async start (/app/index.js:25:9) {
mysql-1 | 2026-02-25T21:23:41.521499Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld
mysql-1 | 2026-02-25T21:23:41.523310Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.8' socket: '/var/run/mysqld/mys
backend-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1133:16) {
backend-1 | errno: -111,
backend-1 | code: 'ECONNREFUSED',
backend-1 | syscall: 'connect',
backend-1 | address: '172.18.0.2',
backend-1 | port: 3306,
backend-1 | fatal: true
backend-1 | },
backend-1 | original: Error: connect ECONNREFUSED 172.18.0.2:3306
backend-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1133:16) {
backend-1 | errno: -111,
backend-1 | code: 'ECONNREFUSED',
backend-1 | syscall: 'connect',
backend-1 | address: '172.18.0.2',
backend-1 | port: 3306,
backend-1 | fatal: true
backend-1 | }
backend-1 | }
backend-1 | [nodemon] clean exit - waiting for changes before restart
frontend-1 | (node:25) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /app/node_modules/postcss-safe-parser/node_modules/postcss/package.json.
frontend-1 | Update this package.json to use a subpath pattern like "./*".
frontend-1 | (Use `node --trace-deprecation ...` to show where the warning was created)
frontend-1 | ℹ 「wds」: Project is running at http://172.18.0.3/
frontend-1 | ℹ 「wds」: webpack output is served from
frontend-1 | ℹ 「wds」: Content not from webpack is served from /app/public
frontend-1 | ℹ 「wds」: 404s will fallback to /
frontend-1 | Starting the development server...
frontend-1 |
frontend-1 | Compiled with warnings.
frontend-1 |
frontend-1 | src/App.js
frontend-1 | Line 19:8: React Hook useEffect has a missing dependency: 'user'. Either include it or remove the dependency array react-hooks/exhaustive-deps
frontend-1 |
frontend-1 | src/components/TypeBar.js
frontend-1 | Line 4:8: 'Col' is defined but never used no-unused-vars
frontend-1 |
frontend-1 | src/components/modals/CreateBrand.js
frontend-1 | Line 4:22: 'createType' is defined but never used no-unused-vars
frontend-1 |
frontend-1 | src/components/modals/CreateDevice.js
frontend-1 | Line 5:36: 'fetchDevices' is defined but never used no-unused-vars
frontend-1 | Line 18:8: React Hook useEffect has a missing dependency: 'device'. Either include it or remove the dependency array react-hooks/exhaustive-deps
frontend-1 |
frontend-1 | src/http/deviceAPI.js
frontend-1 | Line 2:8: 'jwt_decode' is defined but never used no-unused-vars
frontend-1 |
frontend-1 | src/pages/Auth.js
frontend-1 | Line 26:17: 'data' is assigned a value but never used no-unused-vars
frontend-1 |
frontend-1 | src/pages/DevicePage.js
frontend-1 | Line 12:8: React Hook useEffect has a missing dependency: 'id'. Either include it or remove the dependency array react-hooks/exhaustive-deps
frontend-1 |
frontend-1 | src/pages/Shop.js
frontend-1 | Line 23:8: React Hook useEffect has a missing dependency: 'device'. Either include it or remove the dependency array react-hooks/exhaustive-deps
frontend-1 | Line 30:8: React Hook useEffect has a missing dependency: 'device'. Either include it or remove the dependency array react-hooks/exhaustive-deps
frontend-1 |
frontend-1 | Search for the keywords to learn more about each warning.
frontend-1 | To ignore, add // eslint-disable-next-line to the line before.
frontend-1 |