Running x86_64 Docker Images on Mac M1 Max (Oracle Database 19c)

 

shutterstock_2086551985.jpg

A few months ago, I wrote a post about me switching back to Windows (here).  I can say I gave it an honest try on switching back, but couldn’t stick with it.  In the end, I ended up figuring out how to get back to the MacBook Pro.  I’m still not 100% sold on the M1 processor (ARM architecture) and think that software needs to catch up, especially if you want to do development work with enterprise databases locally (Oracle specifically). 

In attempting to make the switch back, I initially started with Docker Desktop for Apple Chip (here) which is great for just about any docker container I wanted to run.  Just had to provide the —platform=linux/amd64 option.  When I tried this it gave mixed results on the containers that it would run.  Docker clearly states that it is to be used as a “best effort” approach to running x86 containers.  Making the attempt an interesting approach to running containers.  

When you start to look at what everyone is doing and saying about the M1/M2 chip, what you hear is that they are fast and great for development.  And what is the tool that everyone runs for development – Docker.  With all the x86-64 containers out there, how do you get one to run on the M1 when Docker Desktop doesn’t fit the bill completely?  From doing the research and the frustrations associated, I’ve come across an open-source product called “colima”.  Now, I’m more of a person who wants the tried and true approach and Docker Desktop should have been able to run the Oracle Containers from Oracle Container Registry, but it was failing.  Decided to give colima a try!

The first thing I needed to do was remove Docker Desktop (here) from my MacBook Pro.  Wanted to avoid any crossover with the software.  Next, I used Homebrew to install the following:

$brew install docker
$brew install docker-compose
$brew install colima
$brew reinstall qemu

I’m not going to bore you with all the reasons why you have to install these four packages, but know they are needed.  The reinstall of qemu is needed though to correct a problem in colima.

After getting colima installed, the next thing needed is to start up the VM that will run the containers.

$colima start -c 4 -m 12 -a x86_64

I’ve used the short hand settings here, but what I’m asking colima for is a VM that uses 4 cpus, 12G of memory, and support the x86_64 architecture. This should allow me to download and run an x86_64 container.

Now, I need to check the status of the VM that was started.

$colima list

colima_status.png

 

 

As you can tell, I have a default VM running with settings I asked for.  Next, I’ll need to see if I can run a container within it.  

The container that I’ve elected to run is the 19c container that can be found in the Oracle Container Registry (here). The tag I was looking for is 19.3.0.0 at the bottom of the page.

19c-container.png

To make the process a bit more streamlined, I decided to pull the container when I execute the run option for docker.  The following command is what I used:

docker run -d --name ora19c \
--privileged \
--memory=4096M \
-p 1523:1521/tcp -p 5502:5500/tcp \
-e ORACLE_SID=ORCLCDB \
-e ORACLE_PDB=ORCLPDB \
-e ORACLE_PWD=WElcome12345## \
-e INIT_SGA_SIZE=2048M \
-e INIT_PGA_SIZE=500MB \
-e ORACLE_EDITION=EE \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-e ENABLE_ARCHIVELOG=true \
-v /Users/bcurtis/Build_Software/data/19c:/opt/oracle/oradata \
container-registry.oracle.com/database/enterprise:19.3.0.0

Notice that I did not have to specifiy the —platform=linux/amd64 option in the run command.  This is because I’m running colima as an x86_64 container.  This command will also pull the container down and install the Oracle Database 19c.  

After the container comes online, I should get presented with a “healthy” status.  This means that the container is up, running, and I can access the database via my desired tool to work with the database.

bcurtis@Bobbys-MacBook-Pro ~ % dc
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e86c260aa230 container-registry.oracle.com/database/enterprise:19.3.0.0 "/bin/sh -c 'exec $O…" 3 hours ago Up 3 hours (healthy) 0.0.0.0:1523->1521/tcp, :::1523->1521/tcp, 0.0.0.0:5502->5500/tcp, :::5502->5500/tcp ora19c

With the container up and running, I can now access the database from SQL Developer (if needed):

docker_version_19c.png

By installing “colima”, I can now run an supported Oracle Database container on my Apple M1 MacBook Pro.  This will enable me to test out a few thing quickly.  The drawback that I see with this approach though is that colima seems to be a bit slow.  It took about 40 minutes for the container to build once it was pulled.  That was due to the database having to be built once the container is running.

Overall, I think colima looks to be a great alternative to running Docker x86_64 containers on the M1.  Would still like to get this same container to run under Docker Desktop. I have a few ideas I’m going to try, but this is decent way to get going if needed.

Enjoy!

Please follow and like:

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.