Go playground 环境搭建

1.先确保能上外网

2.拉取playground代码

git clone https://go.googlesource.com/playground

3.分别创建playground与sandox 的 docker image

playground:

cd playground
docker build -t golang/playground .

sandbox:

cd playground/sandbox
docker build -f Dockerfile --tag=golang/playground-sandbox ..

4.分别启动sandbox和playground

sandbox:

    docker network create sandnet || true
	docker kill sandbox_dev || true
	docker run --name=sandbox_dev --rm --network=sandnet -ti -p 127.0.0.1:8080:80/tcp -v /var/run/docker.sock:/var/run/docker.sock golang/playground-sandbox:latest

 playground:

    docker network create sandnet || true
	docker kill play_dev || true
	docker run --name=play_dev --rm --network=sandnet -p 8081:8080 golang/playground --backend-url="http://sandbox_dev.sandnet/run"

sandbox在8080端口运行,playground在8081端口运行

这时候就可以在8081打开web交互

Go playground 环境搭建_第1张图片

 

你可能感兴趣的:(golang)