Check when the container cannot be accessed from Host in the Laravel on docker environment using VS Code's Remote container.

Check when the container cannot be accessed from Host in the Laravel on docker environment using VS Code's Remote container.

First PHP, Laravel, only the remedy memo

environment

--Using VSCode Remote container --Composed of Nginx, Laravel, and DB containers --Host, access localhost: 8000 with Chrome from outside the container

problem

Access from local (host) with remote container of VSCode Become a 502 Bad Gateway

.devcontainer/devcontainer.json

// Use 'forwardPorts' to make a list of ports inside the container available locally.
	"forwardPorts": [
		8000
	],

With the above settings

local => It seems that nginx in the container can be reached

Solution

Comment out the following command of .devcontainer / devcontainer.json

# Overrides default command so things don't shut down after the process ends.
#Comment out the following
# command: /bin/sh -c "while sleep 1000; do :; done" 

reference

php - nginx does not open localhost with VSCode Remote Containers Extension (docker compose) - Stack Overflow

Recommended Posts

Check when the container cannot be accessed from Host in the Laravel on docker environment using VS Code's Remote container.
Host specification when laravel php artisan serve in docker container
Install lsb_release from the command line when lsb_release fails in docker environment
Organize communication in an environment that uses various resources on the host machine and Docker container
How to check the logs in the Docker container
Just install Laravel8 on docker in PHP8 environment
[Android] Solution when the camera cannot be started on Android 9
Systemctl cannot be used on Ubuntu inside Docker container
Run the Android emulator on Docker using Android Emulator Container Scripts
[Docker context] ~ How to access docker in remote environment from VScode ~
Configuration script for using docker in proxy environment on ubuntu 20.04.1
[Docker] How to access the host from inside the container. http://host.docker.internal:
Use MailHog for checking emails in the development environment (using Docker)
Open VS Code Remote Containers directly from the CLI on Mac
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
Check the contents by docker pull from ECR and start the container
Build a browser test environment using Capybara in the Docker development environment
[Ruby On Rails] In the create action and destroy action, emergency measures when redirect_to action:: show cannot be (cannot be used)
Pg_resetwal can be used to start the PostgreSQL Docker container when WAL is broken and cannot be started.