This Node.js application creates a simple web server that returns all the environment variables defined in the container. It's a useful tool for inspecting environment variable values.
Before you begin, ensure you have Docker installed on your system.
You can build the Docker image using the following command:
docker build -t env-viewer .
To run a Docker container using the image you've built, you can use the following command:
docker run -d --name env-viewer -p 3000:3000 env-viewer
This command will start a container named env-viewer
based on the env-viewer
image, which runs the Node.js application and listens on port 3000.
Once the container is running, you can access the environment variables by opening a web browser and navigating to http://localhost:3000
or the IP address of your Docker host. The page will display the names and values of all the environment variables in the container.
When you're done with the container, you can stop and remove it using the following commands:
docker stop env-viewer
docker rm env-viewer
To remove the Docker image you built, you can use the following command:
docker rmi env-viewer
You can customize the behavior of the application by modifying the server.js
file in the same directory as the Dockerfile. For example, you can change the response format or add additional functionality.