Using export, echo and docker
- Docker
At first we want to use environment variables. For this we use the export command.
export NAME="Alice"
export AGE=25We can display them again with using echo and the $
echo $NAME
echo $AGEIn the second challenge we use them in a web service.
Run the following commands
# Build the image
docker build -t go-env-server .
# Run the container with custom environment variables
docker run -p 8080:8080 -e NAME=${NAME} -e AGE=${AGE} go-env-server Go in your Browser to http://localhost:8080
we can stop the server with Crtl + C
Think about your own variables and pass them to the go-env-server!