Docker
Container Native (CN) - Docker
RELATED: SETUP > Dev Environment > Container - Docker | EXAMPLES > Cloud Solutions#Docker |
Awesome References
Excellent docker tutorial running on aws ECS; read thoroughly; https://docker-curriculum.com/
Explore further
Useful Commands
Container
# start container
$ docker run [image_name][:image_version]
$ docker stop <container_name>
# restart container
$ docker start <container_name> Start container and enter the running container
$ docker run -it <imageName> /bin/bash
root@47383646>:/# pwd
Image
Transfer image between host without using docker image repository
Ideally, the docker image is shared using the docker repository. However, if docker repository is not readily available, use the following docker save and docker load to transfer the image between host. To rebuild using the provided scripts is also an option, but some build could take a long time.
Examples
Create image - basic; basic website hosted by nginx
Github: https://github.com/gabepublic/docker-staticsite-nginx
Docker hub: https://hub.docker.com/repository/docker/gabepublic/staticsite-nginx
Summary:
Services: basic website hosted by nginx;
Docker compose; website - API - ElasticSearch
Docker hub: https://hub.docker.com/repository/docker/gabepublic/sffoodtruck-site-flask
Summary:
Services: basic website python flask; API python flask; ElasticSearch
External API: http://data.sfgov.org/resource/rqzj-sfat.json
Docker compose; elasticsearch and python flask app
build -
environment - passing environment variables into the container
image - image name; can be replaced with build to build the image on the fly (build: .)
volumes - TBD
Docker Images - ready to use
node-red
elasticSearch - see Github: https://github.com/gabepublic/docker-compose-elasticsearch#test-application-by-starting-using-docker-compose
Docker Networking
Docker Networking types:
bridge - the default network driver; used by in standalone container applications to communicate
host - used in docker swarm only; standalone container connects to the host network directly
overlay - used in docker swarm to connect multiple docker daemon
macvlan - used with legacy application, where a MAC address can be assigned to a container to have it appear as if it were a physical device on the network
none - completely disables network that is useful if a custom network driver is used
Docker container network topology is typically:
172.17.0.0/16. The docker bridge (docker0) connects to the docker network (172.17.0.1), the virtual Ethernet interfaces (i.e., veth0, veth1, etc.), as well as to the physical network (e.g., 192.168.1.10). All the containers (i.e.,172.17.0.2,172.17.0.3, etc.) are connected to the docker network, and the virtual Ethernet interfaces (i.e., veth0, veth1, etc.) as well so that they can plug into the network switch. The docker bridge uses NAT to route the containers' traffic into the physical network.

Use
nmapto inspect the network (docker run nmap)Use
ifconfigto showdocker0,vethxxx
Last updated