(software-carpentry) docker docker
So following my exhausting attempt to build a local clone of Kitsune, I decided to do a short dive into Docker. I figure it's important enough a tool that I may as well get the bare minimum familiarity now.
Quick query into Perplexity.ai turned up some good resources. I went with a Docker sponsored, albeit older, online playground tutorial: https://training.play-with-docker.com.
I went with the walk through for developers path. There is a provided in browser terminal instance, but starting with step 3 of the second lesson, some errors start occurring with missing container references. I had to switch to using my local machine.
For the other steps where the provided terminal works, you can also just click on the code blocks--it'll run them in the provided terminal--to make the tutorial go faster.
But I also enjoyed typing some of commands as a chance to practice some CLI keybindings. I'm using a lot of ls and then auto-complete by tabbing. So useful!
Even with this bare minimum tutorial, I had some "hm...interesting" moments. One that stood out for me is that docker manages its images separately from your local machine's file system. "ls" in the command line won't show you the docker images. You have to use "docker image ls".
Of note for the second lesson: Application Containerization and Microservice Orchestration, in steps 4 and 5, I had to change the port allocation in docker-compose.yml:
version: "3"
services:
api:
image: linkextractor-api:step5-python
build: ./api
ports:
- "8000:5000" # Change this line to map port 8000 on the host to port 5000 in the container
environment:
- REDIS_URL=redis://redis:6379
web:
image: linkextractor-web:step5-php
build: ./www
ports:
- "80:80"
environment:
- API_ENDPOINT=http://api:5000/api/
redis:
image: redis
All other port allocations are fine. It just that 5000 is used by Mac OS now.
Also, I couldn't get this command to work: sed -i 's/Link Extractor/Super Link Extractor/g' www/index.php -- so I just manually did a replace all in my IDE.
I didn't go any further than Step 1 of the developer track on https://training.play-with-docker.com.
But here are some other good Docker resources:
Two Udemy Docker endorsed courses.
- https://www.udemy.com/course/learn-docker
- https://www.udemy.com/course/docker-containers
But I'm a proponent of sharing knowledge in a low barrier manner. So here's a University of Helsinki course. It looks like it'll continue for 2024 also. I definitely plan on doing this when I need a break from another project.
side note: now, little me hasn't worked a day in a production setting, but it seems like Docker and k8s can be considered an important tool for the software carpenter so this gets the software carpentry tag.