The docker documentation is actually quite good.
this and
this are the main references I used.
In short, though: docker runs as a daemon on your computer. You talk to it using the "docker" command in your terminal. unless you want to run everything as root, I would add your user to the "docker" group (you'll have to log out then back in after you do this...I actually had to pull a Windoze and reboot...)
The bases for docker is what is called an "image". It's essentially a configuration that docker manages that, for lack of a better term, describes a sandboxed "chroot" that you can access using the "docker" command. There are tons of different images available, mostly on the
docker hub.
To access any of these image's, you simply issue "docker run -it <image name>[:version]". The "-it" makes the access interactive, i.e. it drops you into a shell.
The "hello world" for docker is esentially "docker run -it busybox /bin/sh".
Anywho, the other core aspect of the dockerverse is create new images. It appears (based on my limited knowledge) that the vast majority of new images are created using another image as a base. It seems popular to use "alpine" as a base, because it is a super small variant of linux. Unfortunately, alpine uses a weird glibc alternative called musl that opencascade does not compile against, so instead I used ubuntu as a basis.
In order to create a new docker, there are essentially two steps:
- create a Dockerfile
- run the command "docker build"
The docker file's syntax is pretty basic, but essentially what you need to know is:
Code: Select all
FROM ezzieyguywuf/opencascade:7.3.0
RUN apt-get update \
&& apt-get install git cmake make <other freecad dependencies...> \
&& git clone <wherever freecad is nowadays> \
&& cd FreeCAD \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make -j2 install \
&& cd .. \
&& rm -rf FreeCAD
&& rm -rf /var/lib/apt/lists/* \
&& apt-get --auto-remove purge git cmake make <any -dev packages>
The key points here:
- the "FROM" designates the docker image to use as a basis. The smaller the base, the smaller the final image
- notice I put my entire build in one 'RUN' command. This is to keep the final file size smaller because of "layers" or something. it's a docker thing...
- notice I clean up after myself. Again, this is to keep the final file size small
I'll usually do "docker run -it ezzieyguywuf/opencascade:7.3.0" to drop into an interactive shell and figure out all the commands/dependencies I need to make something build. once I work it out there, I'll just translate that to the docker file, and issue "docker build -t myuser/myimage:myversion" to create the new image. Now I'll have locally available "docker run -it myuser/myimage" (defaults to latest version) to run. If I want to make publically available, I create a docker hub account and "docker login" then "docker push myuser/myimage:myversion".
If it sounds pretty simple it's because it is. It's been quite the treat working with docker.
Do spend some time reading some of the docs though: it's not overly technical or cumbersome and will likely make your life easier.