Docker
Appendix: General Docker Procedures
The sections below outline learnings from a beginners use of Docker (me). If they save you time, we're both happy.
Docker Installation
It's simple on a Mac, running natively. Other configurations may cause drama:
- Virtualization - under virtualization (e.g., VMWare Fusion - running windows under Mac), it is much slower.
- Bootcamp - I was not able to make it work -- Windows thought the firmware did not support virtualization (on a large Intel-based Macbook Pro)
On the Fusion Windows, it seemed that I needed Windows Pro (not Home). There are various sites that discuss Windows Home. I was not willing to fiddle with that, so I just went Pro, which worked well.
Creating Containerized API Logic Server Projects for VSCode
When you use API Logic Server to create projects, the resultant projects can run with a venv
(locally installed Python), or in a Docker container.
To make this work, ApiLogicServer create
builds the following files in your project:
Preparing a Python Image (for API Logic Server)
Recall that an image is something you can store on Docker Hub so others can download and run. It's a good idea for project to have a repository of docker images, such as ApiLogicServer, test databases, etc.
The running thing is called a container. They can but typically do not utilize local storage, instead accessing external files through mounts, and external systems (databases, APIs) via docker networks and ports.
I had to prepare a Docker image for ApiLogicServer (providing Python, API Logic Server CLI and runtime libraries). That requires a Dockerfile, where I also keep my notes.
The process was straight-forward using the noted links... until
pyodbc
was added for Sql Server. That added 500MB, and was quite complicated.
Preparing a Database Image (for self-contained databases)
In addition to the ApiLogicServer image, I wanted folks to be able to access a dockerized MySQL database. Further, I wanted this to be self-contained to avoid creating files on folks' hard drives.
I therefore needed to:
- acquire a self-contained MySQL image (again, that's not the default - the default is data persisted to a volume), and
- update this database with test data
- save this altered container as an image (
docker commit...
)
I used this Dockerfile which again includes my notes.
SQL Server Docker creation
It was prepared as described in this Dockerfile.
For JDBC tools, specify: jdbc:sqlserver://localhost:1433;database= NORTHWND