1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCodeのRemote containerを利用したLaravel on docker環境でHostからコンテナ内にアクセスができない場合に確認すること

Last updated at Posted at 2020-09-03

VSCodeのRemote containerを利用したLaravel on docker環境でHostからコンテナ内にアクセスができない場合に確認すること

初PHP, Laravelにつき対処法のみメモ

環境

  • VSCode Remote container使用
  • Nginx, Laravel, DBの各コンテナで構成
  • Host, コンテナの外からChromeでlocalhost:8000にアクセス

問題

VSCodeのremote containerでlocal(host)からのアクセスが
502 Bad Gatewayになる

.devcontainer/devcontainer.json

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

上記設定済みで

local => コンテナ内のnginxまでは到達できている様子

解決

.devcontainer/devcontainer.jsoncommand以下をコメントアウトする

# Overrides default command so things don't shut down after the process ends.
# 以下をコメントアウト
# command: /bin/sh -c "while sleep 1000; do :; done" 

参考

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

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?