July 2017
Beginner to intermediate
358 pages
10h 54m
English
To connect a container to a custom network, let's again use the example application that we created in Chapter 1, Introduction to Microservices:
$ docker run -it --rm -v $(pwd):/src -w /src --name server --network=testnetwork golang:alpine go run main.go
Did you get the error message that the name is already in use because you forgot to remove the container in the earlier section? If so, it might be time to head back a few pages.
Assuming all went well, you should see the server starting message, now let's try to curl the container using the same command we executed earlier:
$ docker run --rm appropriate/curl:latest curl -i -XPOST server:8080/helloworld -d '{"name":"Nic"}'
You should have received ...
Read now
Unlock full access