Point reading material to Wiki
parent
aa078cf9a9
commit
345b594f41
51
README.md
51
README.md
|
@ -2,46 +2,17 @@
|
|||
|
||||
This repository is a playground for practising docker based programming following [docker-development-youtube-series](https://github.com/marcel-dempers/docker-development-youtube-series)
|
||||
|
||||
## Three Problems for docker beginner
|
||||
Please refer to Wiki for detailed documentation.
|
||||
|
||||
1. Programmer need be able to navigate through windows/mac/linux OS using cmd line fluently:
|
||||
1. `ls/dir` for list files
|
||||
2. `cd` for move through file systems
|
||||
2. Working Directories
|
||||
1. Show current working directory `echo $PWD`
|
||||
2. Don't hardcode path to file in docker files
|
||||
3. Understand *docker volume* `docker run -v hostPath:containerPath`
|
||||
1. e.g. `docker run -it -v $PWD:/work -w /work alpine:3.9 /bin/sh`
|
||||
## Reference
|
||||
|
||||
## dockerfile
|
||||
VSCode official document contains many good information:
|
||||
* [Developing inside a Container](https://code.visualstudio.com/docs/remote/containers)
|
||||
* [devcontainer.json](https://code.visualstudio.com/docs/remote/devcontainerjson-reference) file used to tell VSCode how to access a development container
|
||||
* [Tutorial: Remote development in Container](https://code.visualstudio.com/docs/remote/containers-tutorial)
|
||||
* [ASP.NET Core in a container](https://code.visualstudio.com/docs/containers/quickstart-aspnet-core) describe how to create ASP.NET container from local environment (not recommended for docker-based development)
|
||||
* [Container tips for docker development (like remote)](https://code.visualstudio.com/docs/remote/troubleshooting#_container-tips)
|
||||
* [Adding extension to devcontainer.json](https://code.visualstudio.com/docs/remote/containers#_adding-an-extension-to-devcontainerjson)
|
||||
|
||||
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
|
||||
|
||||
1. Create image using `docker-compose.yaml` & `Dockerfile`
|
||||
1. Write `Dockerfile` and `docker-compose.yaml`
|
||||
2. Create image: `docker-compose build first-public-dockerhub-image` where
|
||||
1. `first-public-dockerhub-image` is the service name of the image
|
||||
2. Login Docker hub
|
||||
1. `docker login`, without specify server address, it automatically connect to DockerHub
|
||||
2. Enter Username & Password
|
||||
3. Now computer has login DockerHub successfully
|
||||
3. Go to Docker hub, create the `first-public-dockerhub-image` repository
|
||||
4. Go to command line, push the image `docker push cruxligh/first-public-dockerhub-image`
|
||||
|
||||
References:
|
||||
1. How to register a dockerhub registry: [Docker Hub QuickStart](https://docs.docker.com/docker-hub/)
|
||||
Blogs with good Docker related information:
|
||||
* [Code in a Container](https://nabeelvalley.netlify.app/blog/2020/25-07/developing-in-a-container-vscode/)
|
Loading…
Reference in New Issue