cannot connect laravel with mysql inside a docker container [duplicate]

I have laravel 11 application and it works fine. I want the application to run inside docker and I have the following docker file set up for the laravel app:

FROM php:8.3-fpm

RUN apt-get update && apt-get install -y 
    && docker-php-ext-install pdo_mysql

WORKDIR /var/www

COPY . /var/www/

RUN curl -sS https://getcomposer.org/installer | php 
    && mv composer.phar /usr/local/bin/composer

RUN composer install

EXPOSE 8000

CMD ["php", "artisan", "serve", "--host=127.0.0.1", "--port=8000"]

and here is my .env file for laravel.

APP_NAME="News"
APP_ENV=local
APP_KEY=base64:54Cuy//nhKFvtc+ir8SY6VinO6Av+qIdMSj9R9YSm8g=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=dbnews
DB_USERNAME=dbuser
DB_PASSWORD=dbpasss

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mail.domain.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD='&6gT5%$'
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"

I am using docker compose so here is the docker-compose.yml file:

services:
  laravel:
    build:
      context: ./back
    volumes:
      - ./back:/var/www
    ports:
      - "8000:8000"
    depends_on:
      - db

  db:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: dbnews
      MYSQL_USER: dbuser
      MYSQL_PASSWORD: dbpass
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql

  nuxt:
    build:
      context: ./front
    volumes:
      - ./front:/app
    ports:
      - "3000:3000"
    depends_on:
      - laravel

volumes:
  db_data:

docker compose up –build produces the following output:

db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
db_1       | 2024-09-18T13:14:45.813462Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
db_1       | 2024-09-18T13:14:45.815269Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.39) starting as process 1
db_1       | 2024-09-18T13:14:45.821078Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
laravel_1  | 
laravel_1  |    INFO  Server running on [http://127.0.0.1:8000].  
laravel_1  | 
laravel_1  |   Press Ctrl+C to stop the server
laravel_1  | 
db_1       | 2024-09-18T13:14:46.215960Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1       | 2024-09-18T13:14:46.355592Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
nuxt_1     | 
nuxt_1     | > nuxt-app@ dev /app
nuxt_1     | > nuxt dev
nuxt_1     | 
db_1       | 2024-09-18T13:14:46.377436Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
db_1       | 2024-09-18T13:14:46.415536Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1       | 2024-09-18T13:14:46.415570Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1       | 2024-09-18T13:14:46.420131Z 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.
db_1       | 2024-09-18T13:14:46.449135Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db_1       | 2024-09-18T13:14:46.449332Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.39'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
nuxt_1     | Nuxt 3.13.1
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     | 
nuxt_1     |   ➜ Local:    http://localhost:3000/
nuxt_1     |   ➜ Network:  use --host to expose
nuxt_1     | 
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     |   ➜ DevTools: press Shift + Alt + D in the browser (v1.4.2)
nuxt_1     | 
nuxt_1     | ✔ Vite client built in 47ms
nuxt_1     | ✔ Vite server built in 1305ms
nuxt_1     | [nitro] ✔ Nuxt Nitro server built in 585 ms
nuxt_1     | ℹ Vite client warmed up in 0ms
nuxt_1     | ℹ Vite server warmed up in 2306ms

and I can access the front nuxt application fine but the cannot access localhost:8000 at all. When I could connect to the laravel app I got the following error in the browser:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Name or service not known (Connection: mysql, SQL: select * from sessions where id = b5JVyzFscjEITCRRj7Hud0lxhyN9hyYX4pK29hyK limit 1) 

but now I cannot connect at all so a new issue.

If I then run the same docker compose up –build command again I get the following error:

ERROR: for laravel  'ContainerConfig'
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 203, in perform_command
    handler(command, command_options)
  File "/usr/local/lib/python3.10/dist-packages/compose/metrics/decorator.py", line 18, in wrapper
    result = fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1186, in up
    to_attach = up(False)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1166, in up
    return self.project.up(
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 697, in up
    results, errors = parallel.parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 679, in do
    return service.execute_convergence_plan(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 579, in execute_convergence_plan
    return self._execute_convergence_recreate(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 499, in _execute_convergence_recreate
    containers, errors = parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 494, in recreate
    return self.recreate_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 612, in recreate_container
    new_container = self.create_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 330, in create_container
    container_options = self._get_container_create_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 921, in _get_container_create_options
    container_options, override_options = self._build_container_volume_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 960, in _build_container_volume_options
    binds, affinity = merge_volume_bindings(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1548, in merge_volume_bindings
    old_volumes, old_mounts = get_container_data_volumes(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1579, in get_container_data_volumes
    container.image_config['ContainerConfig'].get('Volumes') or {}
KeyError: 'ContainerConfig'

I upgraded to the latest docker desktop so not really sure what to do next. If I delete the containers and start again I do not get the last set of errors.

Anybody can help me how to make this work please?

1

Use your mysql containr’s name for DB_HOST.
DB_HOST=db

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

cannot connect laravel with mysql inside a docker container [duplicate]

I have laravel 11 application and it works fine. I want the application to run inside docker and I have the following docker file set up for the laravel app:

FROM php:8.3-fpm

RUN apt-get update && apt-get install -y 
    && docker-php-ext-install pdo_mysql

WORKDIR /var/www

COPY . /var/www/

RUN curl -sS https://getcomposer.org/installer | php 
    && mv composer.phar /usr/local/bin/composer

RUN composer install

EXPOSE 8000

CMD ["php", "artisan", "serve", "--host=127.0.0.1", "--port=8000"]

and here is my .env file for laravel.

APP_NAME="News"
APP_ENV=local
APP_KEY=base64:54Cuy//nhKFvtc+ir8SY6VinO6Av+qIdMSj9R9YSm8g=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=dbnews
DB_USERNAME=dbuser
DB_PASSWORD=dbpasss

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mail.domain.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD='&6gT5%$'
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"

I am using docker compose so here is the docker-compose.yml file:

services:
  laravel:
    build:
      context: ./back
    volumes:
      - ./back:/var/www
    ports:
      - "8000:8000"
    depends_on:
      - db

  db:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: dbnews
      MYSQL_USER: dbuser
      MYSQL_PASSWORD: dbpass
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql

  nuxt:
    build:
      context: ./front
    volumes:
      - ./front:/app
    ports:
      - "3000:3000"
    depends_on:
      - laravel

volumes:
  db_data:

docker compose up –build produces the following output:

db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
db_1       | 2024-09-18T13:14:45.813462Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
db_1       | 2024-09-18T13:14:45.815269Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.39) starting as process 1
db_1       | 2024-09-18T13:14:45.821078Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
laravel_1  | 
laravel_1  |    INFO  Server running on [http://127.0.0.1:8000].  
laravel_1  | 
laravel_1  |   Press Ctrl+C to stop the server
laravel_1  | 
db_1       | 2024-09-18T13:14:46.215960Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1       | 2024-09-18T13:14:46.355592Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
nuxt_1     | 
nuxt_1     | > nuxt-app@ dev /app
nuxt_1     | > nuxt dev
nuxt_1     | 
db_1       | 2024-09-18T13:14:46.377436Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
db_1       | 2024-09-18T13:14:46.415536Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1       | 2024-09-18T13:14:46.415570Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1       | 2024-09-18T13:14:46.420131Z 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.
db_1       | 2024-09-18T13:14:46.449135Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db_1       | 2024-09-18T13:14:46.449332Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.39'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
nuxt_1     | Nuxt 3.13.1
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     | 
nuxt_1     |   ➜ Local:    http://localhost:3000/
nuxt_1     |   ➜ Network:  use --host to expose
nuxt_1     | 
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     |   ➜ DevTools: press Shift + Alt + D in the browser (v1.4.2)
nuxt_1     | 
nuxt_1     | ✔ Vite client built in 47ms
nuxt_1     | ✔ Vite server built in 1305ms
nuxt_1     | [nitro] ✔ Nuxt Nitro server built in 585 ms
nuxt_1     | ℹ Vite client warmed up in 0ms
nuxt_1     | ℹ Vite server warmed up in 2306ms

and I can access the front nuxt application fine but the cannot access localhost:8000 at all. When I could connect to the laravel app I got the following error in the browser:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Name or service not known (Connection: mysql, SQL: select * from sessions where id = b5JVyzFscjEITCRRj7Hud0lxhyN9hyYX4pK29hyK limit 1) 

but now I cannot connect at all so a new issue.

If I then run the same docker compose up –build command again I get the following error:

ERROR: for laravel  'ContainerConfig'
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 203, in perform_command
    handler(command, command_options)
  File "/usr/local/lib/python3.10/dist-packages/compose/metrics/decorator.py", line 18, in wrapper
    result = fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1186, in up
    to_attach = up(False)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1166, in up
    return self.project.up(
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 697, in up
    results, errors = parallel.parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 679, in do
    return service.execute_convergence_plan(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 579, in execute_convergence_plan
    return self._execute_convergence_recreate(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 499, in _execute_convergence_recreate
    containers, errors = parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 494, in recreate
    return self.recreate_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 612, in recreate_container
    new_container = self.create_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 330, in create_container
    container_options = self._get_container_create_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 921, in _get_container_create_options
    container_options, override_options = self._build_container_volume_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 960, in _build_container_volume_options
    binds, affinity = merge_volume_bindings(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1548, in merge_volume_bindings
    old_volumes, old_mounts = get_container_data_volumes(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1579, in get_container_data_volumes
    container.image_config['ContainerConfig'].get('Volumes') or {}
KeyError: 'ContainerConfig'

I upgraded to the latest docker desktop so not really sure what to do next. If I delete the containers and start again I do not get the last set of errors.

Anybody can help me how to make this work please?

1

Use your mysql containr’s name for DB_HOST.
DB_HOST=db

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

cannot connect laravel with mysql inside a docker container [duplicate]

I have laravel 11 application and it works fine. I want the application to run inside docker and I have the following docker file set up for the laravel app:

FROM php:8.3-fpm

RUN apt-get update && apt-get install -y 
    && docker-php-ext-install pdo_mysql

WORKDIR /var/www

COPY . /var/www/

RUN curl -sS https://getcomposer.org/installer | php 
    && mv composer.phar /usr/local/bin/composer

RUN composer install

EXPOSE 8000

CMD ["php", "artisan", "serve", "--host=127.0.0.1", "--port=8000"]

and here is my .env file for laravel.

APP_NAME="News"
APP_ENV=local
APP_KEY=base64:54Cuy//nhKFvtc+ir8SY6VinO6Av+qIdMSj9R9YSm8g=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=dbnews
DB_USERNAME=dbuser
DB_PASSWORD=dbpasss

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mail.domain.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD='&6gT5%$'
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"

I am using docker compose so here is the docker-compose.yml file:

services:
  laravel:
    build:
      context: ./back
    volumes:
      - ./back:/var/www
    ports:
      - "8000:8000"
    depends_on:
      - db

  db:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: dbnews
      MYSQL_USER: dbuser
      MYSQL_PASSWORD: dbpass
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql

  nuxt:
    build:
      context: ./front
    volumes:
      - ./front:/app
    ports:
      - "3000:3000"
    depends_on:
      - laravel

volumes:
  db_data:

docker compose up –build produces the following output:

db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
db_1       | 2024-09-18T13:14:45.813462Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
db_1       | 2024-09-18T13:14:45.815269Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.39) starting as process 1
db_1       | 2024-09-18T13:14:45.821078Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
laravel_1  | 
laravel_1  |    INFO  Server running on [http://127.0.0.1:8000].  
laravel_1  | 
laravel_1  |   Press Ctrl+C to stop the server
laravel_1  | 
db_1       | 2024-09-18T13:14:46.215960Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1       | 2024-09-18T13:14:46.355592Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
nuxt_1     | 
nuxt_1     | > nuxt-app@ dev /app
nuxt_1     | > nuxt dev
nuxt_1     | 
db_1       | 2024-09-18T13:14:46.377436Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
db_1       | 2024-09-18T13:14:46.415536Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1       | 2024-09-18T13:14:46.415570Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1       | 2024-09-18T13:14:46.420131Z 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.
db_1       | 2024-09-18T13:14:46.449135Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db_1       | 2024-09-18T13:14:46.449332Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.39'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
nuxt_1     | Nuxt 3.13.1
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     | 
nuxt_1     |   ➜ Local:    http://localhost:3000/
nuxt_1     |   ➜ Network:  use --host to expose
nuxt_1     | 
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     |   ➜ DevTools: press Shift + Alt + D in the browser (v1.4.2)
nuxt_1     | 
nuxt_1     | ✔ Vite client built in 47ms
nuxt_1     | ✔ Vite server built in 1305ms
nuxt_1     | [nitro] ✔ Nuxt Nitro server built in 585 ms
nuxt_1     | ℹ Vite client warmed up in 0ms
nuxt_1     | ℹ Vite server warmed up in 2306ms

and I can access the front nuxt application fine but the cannot access localhost:8000 at all. When I could connect to the laravel app I got the following error in the browser:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Name or service not known (Connection: mysql, SQL: select * from sessions where id = b5JVyzFscjEITCRRj7Hud0lxhyN9hyYX4pK29hyK limit 1) 

but now I cannot connect at all so a new issue.

If I then run the same docker compose up –build command again I get the following error:

ERROR: for laravel  'ContainerConfig'
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 203, in perform_command
    handler(command, command_options)
  File "/usr/local/lib/python3.10/dist-packages/compose/metrics/decorator.py", line 18, in wrapper
    result = fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1186, in up
    to_attach = up(False)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1166, in up
    return self.project.up(
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 697, in up
    results, errors = parallel.parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 679, in do
    return service.execute_convergence_plan(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 579, in execute_convergence_plan
    return self._execute_convergence_recreate(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 499, in _execute_convergence_recreate
    containers, errors = parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 494, in recreate
    return self.recreate_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 612, in recreate_container
    new_container = self.create_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 330, in create_container
    container_options = self._get_container_create_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 921, in _get_container_create_options
    container_options, override_options = self._build_container_volume_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 960, in _build_container_volume_options
    binds, affinity = merge_volume_bindings(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1548, in merge_volume_bindings
    old_volumes, old_mounts = get_container_data_volumes(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1579, in get_container_data_volumes
    container.image_config['ContainerConfig'].get('Volumes') or {}
KeyError: 'ContainerConfig'

I upgraded to the latest docker desktop so not really sure what to do next. If I delete the containers and start again I do not get the last set of errors.

Anybody can help me how to make this work please?

1

Use your mysql containr’s name for DB_HOST.
DB_HOST=db

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

cannot connect laravel with mysql inside a docker container [duplicate]

I have laravel 11 application and it works fine. I want the application to run inside docker and I have the following docker file set up for the laravel app:

FROM php:8.3-fpm

RUN apt-get update && apt-get install -y 
    && docker-php-ext-install pdo_mysql

WORKDIR /var/www

COPY . /var/www/

RUN curl -sS https://getcomposer.org/installer | php 
    && mv composer.phar /usr/local/bin/composer

RUN composer install

EXPOSE 8000

CMD ["php", "artisan", "serve", "--host=127.0.0.1", "--port=8000"]

and here is my .env file for laravel.

APP_NAME="News"
APP_ENV=local
APP_KEY=base64:54Cuy//nhKFvtc+ir8SY6VinO6Av+qIdMSj9R9YSm8g=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=dbnews
DB_USERNAME=dbuser
DB_PASSWORD=dbpasss

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mail.domain.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD='&6gT5%$'
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"

I am using docker compose so here is the docker-compose.yml file:

services:
  laravel:
    build:
      context: ./back
    volumes:
      - ./back:/var/www
    ports:
      - "8000:8000"
    depends_on:
      - db

  db:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: dbnews
      MYSQL_USER: dbuser
      MYSQL_PASSWORD: dbpass
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql

  nuxt:
    build:
      context: ./front
    volumes:
      - ./front:/app
    ports:
      - "3000:3000"
    depends_on:
      - laravel

volumes:
  db_data:

docker compose up –build produces the following output:

db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1       | 2024-09-18 13:14:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started.
db_1       | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
db_1       | 2024-09-18T13:14:45.813462Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
db_1       | 2024-09-18T13:14:45.815269Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.39) starting as process 1
db_1       | 2024-09-18T13:14:45.821078Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
laravel_1  | 
laravel_1  |    INFO  Server running on [http://127.0.0.1:8000].  
laravel_1  | 
laravel_1  |   Press Ctrl+C to stop the server
laravel_1  | 
db_1       | 2024-09-18T13:14:46.215960Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1       | 2024-09-18T13:14:46.355592Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
nuxt_1     | 
nuxt_1     | > nuxt-app@ dev /app
nuxt_1     | > nuxt dev
nuxt_1     | 
db_1       | 2024-09-18T13:14:46.377436Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
db_1       | 2024-09-18T13:14:46.415536Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1       | 2024-09-18T13:14:46.415570Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1       | 2024-09-18T13:14:46.420131Z 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.
db_1       | 2024-09-18T13:14:46.449135Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db_1       | 2024-09-18T13:14:46.449332Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.39'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
nuxt_1     | Nuxt 3.13.1
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     | 
nuxt_1     |   ➜ Local:    http://localhost:3000/
nuxt_1     |   ➜ Network:  use --host to expose
nuxt_1     | 
nuxt_1     | 
nuxt_1     |  WARN  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
nuxt_1     | 
nuxt_1     |   ➜ DevTools: press Shift + Alt + D in the browser (v1.4.2)
nuxt_1     | 
nuxt_1     | ✔ Vite client built in 47ms
nuxt_1     | ✔ Vite server built in 1305ms
nuxt_1     | [nitro] ✔ Nuxt Nitro server built in 585 ms
nuxt_1     | ℹ Vite client warmed up in 0ms
nuxt_1     | ℹ Vite server warmed up in 2306ms

and I can access the front nuxt application fine but the cannot access localhost:8000 at all. When I could connect to the laravel app I got the following error in the browser:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Name or service not known (Connection: mysql, SQL: select * from sessions where id = b5JVyzFscjEITCRRj7Hud0lxhyN9hyYX4pK29hyK limit 1) 

but now I cannot connect at all so a new issue.

If I then run the same docker compose up –build command again I get the following error:

ERROR: for laravel  'ContainerConfig'
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 203, in perform_command
    handler(command, command_options)
  File "/usr/local/lib/python3.10/dist-packages/compose/metrics/decorator.py", line 18, in wrapper
    result = fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1186, in up
    to_attach = up(False)
  File "/usr/local/lib/python3.10/dist-packages/compose/cli/main.py", line 1166, in up
    return self.project.up(
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 697, in up
    results, errors = parallel.parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/project.py", line 679, in do
    return service.execute_convergence_plan(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 579, in execute_convergence_plan
    return self._execute_convergence_recreate(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 499, in _execute_convergence_recreate
    containers, errors = parallel_execute(
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/local/lib/python3.10/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 494, in recreate
    return self.recreate_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 612, in recreate_container
    new_container = self.create_container(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 330, in create_container
    container_options = self._get_container_create_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 921, in _get_container_create_options
    container_options, override_options = self._build_container_volume_options(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 960, in _build_container_volume_options
    binds, affinity = merge_volume_bindings(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1548, in merge_volume_bindings
    old_volumes, old_mounts = get_container_data_volumes(
  File "/usr/local/lib/python3.10/dist-packages/compose/service.py", line 1579, in get_container_data_volumes
    container.image_config['ContainerConfig'].get('Volumes') or {}
KeyError: 'ContainerConfig'

I upgraded to the latest docker desktop so not really sure what to do next. If I delete the containers and start again I do not get the last set of errors.

Anybody can help me how to make this work please?

1

Use your mysql containr’s name for DB_HOST.
DB_HOST=db

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật