It is the understanding of docker and how it was useful in day-to-day tasks, some basic difference between old and new. At last my learnings and mistake while doing it all.
2. How we used to work before docker?
- Remembering all the requirements in our head
- Install the required library manually which we remembered
- Install remaining ones after getting an error while running the code
3. What was the issues in that approach?
- Managing development and production instances use to take very long time
- Output from new member joining the team was not instant
- Chances of errors was high
- Loss of knowledge
- Could have used snippets as requirement knowledge and steps to setup the environment
- Still everyone have to do all the things manually
Any alternatives other then Docker?
4. How docker is solving these issues?
- Setting up the environment is very easy, resulting into less frustrated members and new members
can be productive instantly.
- Migrating any change is now easy, as all changes during development are shipped with the
business logic itself.
- All the configurations are written within a single file, easy to check any setting.
5. What is Docker and Docker-compose?
- Docker is an open source platform for building, deploying, and managing containerized
applications
- Compose is a tool for defining and running multi-container Docker applications
Some common terminology
- DockerFile
- Images
- Containers
- Networks
- DockerHub
7. What happen on docker-compose build?
- Download the images from repository
- Running each command in DockerFile
- Layering up the containers (exclude the container part )
How step 3 works?
8. What happens on docker-compose up -d?
- The images we build in last step will spin-off as containers
9. My learnings
- Debugging - attaching or generating the logs
- docker attach <container_id or name>
- docker logs <container_id or name> > test.log
- Using .dockerignore to increase speed of your building and reduce the image size, exclusion
pattern similar to .gitignore
- Manage env variables - via env variables or env files
- Accessing the services in the same network - Use service names or static IPs
- Accessing the services not in the same network - Passing public server IP in env and access port
10. Unsolved - CakePHP composer install issue
- While building we are copying (one way) the files in the image and when the composer install runs
it uses the composer.json in the image and create a vendor folder inside the image only.
- docker-compose.yml config the service in a way that volume is binded to that copied location, now
the image vendor folder will be removed since the volume will overwrite the internal files.
Probable solution - Let’s not bind the volume to the image, it will directly solve our issue. But
Caveat - Our silent pipeline is based on functionality of volume i.e. 2-way binding.
Final solution - we do a manual composer install when anything new is added in CakePHP
dependencies
11. Orchestration
Orchestration is the automated configuration, management, and coordination of computer systems,
applications, and services. Orchestration helps IT to more easily manage complex tasks and workflows
3 popular tools
- Docker Swarm
- Kubernetes
- Mesos
Just for awareness