

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Dockerfiles
incomplete
2: Building a Server
incomplete
3: Dockerizing the Server
incomplete
4: Creating an Environment
incomplete
5: Python Script
incomplete
6: Dockerizing Python Error
incomplete
7: Dockerizing Python
incomplete
This lesson's interactive features are locked, please to keep using them
Now that you know how to run your server manually, let's run it in Docker! The steps are simple:
FROM debian:stable-slim
# COPY source destination
COPY goserver /bin/goserver
Replace the first "goserver" with the name of your server executable if it's different.
The ADD command would also work here, but COPY is fine because we don't need the extra functionality that ADD offers.
CMD ["/bin/goserver"]
docker build . -t goserver:latest
docker run -p 8010:8010 goserver
If you get an exec format error, it's probably because you built the go server for your local architecture, but you're trying to run it on a Linux OS! To fix it, rebuild the binary (and then the Dockerfile) with these environment variables:
GOOS=linux GOARCH=amd64 go build
Run and submit the CLI tests.