739d7bb64b | ||
---|---|---|
c# | ||
first-public-dockerhub-image | ||
golang | ||
nodejs | ||
python | ||
.gitignore | ||
README.md | ||
docker-compose.yaml |
README.md
README
This repository is a playground for practising docker based programming following docker-development-youtube-series
Three Problems for docker beginner
- Programmer need be able to navigate through windows/mac/linux OS using cmd line fluently:
ls/dir
for list filescd
for move through file systems
- Working Directories
- Show current working directory
echo $PWD
- Don't hardcode path to file in docker files
- Show current working directory
- Understand docker volume
docker run -v hostPath:containerPath
- e.g.
docker run -it -v $PWD:/work -w /work alpine:3.9 /bin/sh
- e.g.
dockerfile
Before bring up docker container, we need first create dockerfile
to describe the image that we want to use to create containers.
For different languages, c#
, golang
& python
each has a separate dockerfile. Each describe the complete environment can be used to develop corresponding programs
Docker compose
Compose
is an orchestration tool that used to spinning up multi-container distributed applications, it shipped with Docker by default. It's not ideal for large system setup, but great for development purpose and testing
It's easy to define a multi-container app and accompanying services using one single file, and start it using single command. We can also build/push images to registry using docker-compose
The compose file is docker-compose.yaml
in PWD
- Build image individually:
docker-compose build <service_name>
- Build all images:
docker-compose build
Create & Push images built from docker-compose
- Create image using
docker-compose.yaml
&Dockerfile
- Write
Dockerfile
anddocker-compose.yaml
- Create image:
docker-compose build first-public-dockerhub-image
wherefirst-public-dockerhub-image
is the service name of the image
- Write
- Login Docker hub
docker login
, without specify server address, it automatically connect to DockerHub- Enter Username & Password
- Now computer has login DockerHub successfully
- Go to Docker hub, create the
first-public-dockerhub-image
repository - Go to command line, push the image
docker push cruxligh/first-public-dockerhub-image
References:
- How to register a dockerhub registry: Docker Hub QuickStart