惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
J
Java Code Geeks
V
V2EX
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
博客园 - Franky
爱范儿
爱范儿
T
Tailwind CSS Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
博客园_首页
B
Blog RSS Feed
博客园 - 司徒正美
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

John Bokma's Hacking and Hiking

Setting up a Brother AirPrinter on Ubuntu Failed to verify signature archive-contents.sig in Emacs Aquamacs 3.6 Hangs When Saving An Encrypted File PAR trouble How To Create a Bootable LibreELEC Installation using Mac OS Running pdflatex Using the Alpine Pandoc LaTeX Docker Image A Docker Image for Sass Timezones in Alpine Docker Containers A Tale of Three Docker Images Debugging a Perl Docker container Perl Time::Piece Unicode Issue Flashing another TP-Link TL-WDR4300 with OpenWrt firmware Rehousing two tarantulas Getting started with the Perl version of tumblelog on Ubuntu 18.04 LTS A visit to Avonturia De Vogelkelder Flashing a TP-Link TL-WDR4300 with OpenWrt firmware Mounting a VDI File in a Different VirtualBox Guest Wireless Headless Raspberry Pi - John Bokma A Matter of Time - John Bokma Hand coding an RSS 2.0 feed in Python RFC #822 and RFC #3339 dates in Perl RFC #822 and RFC #3339 dates in Python Hand coding an RSS 2.0 feed in Perl Nav Element with no Heading Rewriting CommonMark Nodes in Perl "right" this time
Giving Docker Desktop for macOS a Second Chance
John Bokma · 2021-06-03 · via John Bokma's Hacking and Hiking

June 2, 2021

In the evening I installed Docker Desktop on my Mac mini late 2014. Years ago I had looked into Docker for Mac and back then it was not that useful to me, so I stayed with Oracle's VirtualBox. Today I wanted to give docker a second chance and check if I could use it to run Pandoc inside a container to generate a PDF version of my résumé and curriculum vitae.

Installing Docker Desktop for Mac

After I had downloaded the installer, about 600MB, I opened it and macOS verified the downloaded file which took quite some time.

Docker desktop drag and drop install
Docker desktop drag and drop install.

Next, I dragged the Docker icon and dropped it on the Applications folder shown in the installer dialog. The installation process took a few minutes.

Next, I started the Docker.app by double clicking it in the Applications folder. Another, faster, verification step took place and a dialog popped up asking me if I was sure I wanted to open Docker. I clicked the "Open" button and another warning popped up:

Docker Desktop needs privileged access to install its networking components and links to the Docker apps.

You will be asked for your password.

After I had confirmed this action with my password Docker opened a large window with the message "Docker Engine starting...". This also took quite some time.

Testing Docker for Desktop with resume-pandoc

Back in 2016 I made a résumé LaTeX template for the universal document converter Pandoc. To test Docker on my Mac mini I considered this a good candidate especially as there is already an official Docker image: pandoc/latex.

To get started, I first cloned my own GitHub repository as follows:

git clone https://github.com/john-bokma/resume-pandoc.git

This creates a new directory resume-pandoc. Next, I changed into this directory:

cd resume-pandoc

Next, I ran the following Docker command:

docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g`  \
    pandoc/latex perl-programmer-john-bokma-resume.md \
                 -f markdown+yaml_metadata_block \
                 --template templates/jb2resume.latex \
                 -o perl-programmer-john-bokma-resume.pdf

Because this was the first time I ran this command Docker downloaded the latest image for pandoc/latex. After the downloading had finished I got the following error message:

Error producing PDF.
! LaTeX Error: File `enumitem.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.
<read *> 
         
l.14 \usepackage

This means that the package enumitem, which my resume requires, is missing from the official pandoc/latex image. So I created my own Dockerfile with the following contents:

# syntax=docker/dockerfile:1
FROM pandoc/latex:latest
RUN tlmgr update --self && tlmgr install enumitem

This uses the TeX live manager to install the enumitem package. Next, I ran:

docker build --tag=resume-pandoc .

To create my own Docker image with the missing package included.

Next, I ran the following Docker command. Note that I use the name of the newly created Docker image which includes the enumitem package:

docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` \
    resume-pandoc perl-programmer-john-bokma-resume.md \
                  -f markdown+yaml_metadata_block \
                  --template templates/jb2resume.latex \
                  -o perl-programmer-john-bokma-resume.pdf

This resulted in another error: the sectsty package could not be found:

Error producing PDF.
! LaTeX Error: File `sectsty.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.
<read *> 
         
l.58 \sectionfont

So I updated the Dockerfile to include this package as well:

# syntax=docker/dockerfile:1
FROM pandoc/latex:latest
RUN tlmgr update --self && tlmgr install enumitem sectsty

And rebuild the Docker image using:

docker build --tag=resume-pandoc .

After this, I ran the Docker run command again:

docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` \
    resume-pandoc perl-programmer-john-bokma-resume.md \
                  -f markdown+yaml_metadata_block \
                  --template templates/jb2resume.latex \
                  -o perl-programmer-john-bokma-resume.pdf

And this time a PDF version of my résumé was created inside the resume-pandoc directory.

Although this was just a small test it has convinced me to put Docker to actual use on my Mac.

Related