-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02-map-ports
More file actions
executable file
·53 lines (29 loc) · 1.23 KB
/
Copy path02-map-ports
File metadata and controls
executable file
·53 lines (29 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/dash
VERSION=${1:-1.14}
docker container rm -f myAPIserver
clear
echo \$VERSION is $VERSION
set -v
# Simple example of a Docker server application
# Test a Go API server running in a Docker container
# Go API code is adapted from https://github.com/HakaseLabs/source-blog/blob/master/rest-api/main.go
# The image is already build for use. See https://hub.docker.com/repository/docker/dockerfornovices/api-server
# Run with
# `docker container run --publish 8089:8000 --rm --detach --name myAPIserver dockerfornovices/api-server:$VERSION`
# Test with `curl -v http://0.0.0.0:9089/people`
#Get Health check status with `docker container inspect --format '{{.State.Health.Status}}' <ID>"
docker container run --publish 8089:8000 --rm --detach --name myAPIserver dockerfornovices/api-server:$VERSION
sleep 5
docker container ls -a
read x
curl http://0.0.0.0:8089/people
# Now what happens we don't publish ports?
read x
docker container stop myAPIserver
docker container run --rm --detach --name myAPIserver dockerfornovices/api-server:$VERSION
sleep 2
docker container ls -a
curl http://0.0.0.0:8089/people
# No published port means we can't speak to network services inside the container
read x
docker container stop myAPIserver