Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arup-g/docker-go-server
Containerized Golang Server
https://github.com/arup-g/docker-go-server
container docker golang image server
Last synced: 25 days ago
JSON representation
Containerized Golang Server
- Host: GitHub
- URL: https://github.com/arup-g/docker-go-server
- Owner: ARUP-G
- License: apache-2.0
- Created: 2023-09-10T17:18:42.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-12T19:49:06.000Z (9 months ago)
- Last Synced: 2024-02-12T20:49:51.642Z (9 months ago)
- Topics: container, docker, golang, image, server
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker Golang Server
This repository provides a Docker image for running a simple Golang server. The server serves a "Hello" message over HTTP on port 8080.
## Usage
To use this Docker image, follow these steps:
### Step 1: Clone the Repository
Clone this repository to your local machine:
```bash
git clone https://github.com/ARUP-G/Docker-go-server.git
cd Docker-go-server
```### Step 2: Build the Docker Image
Build the Docker image using the provided *Dockerfile*:
```bash
docker build -t docker-go-server .
```### Step 3: Run Docker Container
Run a Docker container from the image you just built:
```bash
docker run -p 8080:8081 -it docker-go-server
```
'-p' maps port 8081 from the container to port 8080 on your host machine.### Step 4: Access the Golang Server
You can access the Golang server by opening a web browser and navigating to http://localhost:8080 or using a tool like *'curl'*:```bash
curl http://localhost:8080
```
You should see the "Hello!" message in the response.### Step 5: Stop and Remove the Docker Container
When you are done using the Golang server, you can stop and remove the Docker container:
```bash
docker stop docker-go-server
docker rm docker-go-server
```
## Customization
If you want to customize the Golang server code, you can edit the *'main.go'* file in the repository. After making your changes, rebuild the Docker image using the same *'docker build'* command mentioned in Step 2.