Skip to content

Commit 1ad13b5

Browse files
committed
Update Docker README
The first example is a quick introduction into how to run the code Add a second part to demonstrate how to edit the code and then re-create the database.
1 parent a57980d commit 1ad13b5

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

README-Docker.md

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Docker README
22

3+
<!-- vim-markdown-toc GFM -->
4+
5+
* [Getting Started](#getting-started)
6+
* [Building Your Docker Container](#building-your-docker-container)
7+
* [Refactoring Your Code](#refactoring-your-code)
8+
* [Mapping your local volume to the Docker container](#mapping-your-local-volume-to-the-docker-container)
9+
* [Creating the database](#creating-the-database)
10+
11+
<!-- vim-markdown-toc -->
12+
13+
## Getting Started
14+
315
A `Dockerfile` has been provided in order to make this code more convenient to run. To get started via `Docker`, you'll need:
416

517
* A working Docker environment
@@ -17,7 +29,7 @@ docker build . -t mmdb-from-go
1729
This will build your Docker container, build your `Go` code and also run the example code for you. To log in to your container, run this command. (Linux users may need to preface this command with `sudo`).
1830

1931
```bash
20-
docker run -it --volume $(pwd):/project mmdb-from-go:latest /bin/bash
32+
docker run -it mmdb-from-go:latest /bin/bash
2133
```
2234

2335
Once you have logged in, you can test out your freshly created database:
@@ -28,8 +40,19 @@ mmdbinspect -db GeoLite2-Country.mmdb \
2840
56.0.0.1 56.1.0.0/24 56.2.0.54 56.3.0.1 | less
2941
```
3042

31-
You can freely edit the code outside of the Docker container and then re-run it from inside the container:
43+
## Refactoring Your Code
44+
45+
You can freely edit the code outside of the Docker container and then re-run it from inside the container. To do so, you'll need to map your local volume to the container and then rebuild the database.
3246

47+
### Mapping your local volume to the Docker container
3348
```bash
34-
./mmdb-from-go-blogpost
35-
```
49+
docker run -it --volume $(pwd):/project mmdb-from-go:latest /bin/bash
50+
```
51+
52+
### Creating the database
53+
54+
Once you are logged in to your container, run the following code:
55+
56+
```bash
57+
go build && ./mmdb-from-go-blogpost
58+
```

0 commit comments

Comments
 (0)