Docker: Your First Container
Preview~15 min3 steps
This sandbox runs its own Docker engine, isolated from everything else. You will run a web server, call it and build your own image.
The images nginx:alpine, alpine and busybox are pre-loaded, because this sandbox has no internet access.
Steps
The sandbox is not running. Launch it to insert commands and verify steps; reading and predicting work without it.
01Run nginx in the background
Start
nginx:alpinedetached (-d), name itweb-demoand publish container port 80 on port 8080 (-p 8080:80).docker run -d --name web-demo -p 8080:80 nginx:alpinedocker ps
02Call your container
Send a request to port 8080, then save the response to
~/workspace/response.html. You should see the nginx welcome page.curl http://localhost:8080curl -s http://localhost:8080 -o ~/workspace/response.html
03Build your own image
A
Dockerfileis waiting in~/workspace/docker-lab. Build it into an image taggedmy-app:v1.cat ~/workspace/docker-lab/Dockerfiledocker build -t my-app:v1 ~/workspace/docker-labdocker images my-app
Private sandbox
Sysbox DinD · 384MB, no internet, deleted after 30 minutes. Your lesson progress is saved in this browser even when the sandbox ends.
Complete the human check to enable launch.