Let Docker access the internet by passing through the VPN connection My host machine, a laptop running Manjaro Linux, is connected via VPN to the internet. I use strongSwan, the open-source IPsec-based VPN solution. IPsec with the IKEv2 protocol is fast and secure. Now, Docker doesn't work. Networking issues are a common problem with VPN and Docker. You can piggyback your Docker container on the host network. That technique only works on Linux machines.
Docker builds containers via layers. All commands add another layer to the already existing image. What does that mean for changing file permissions via chown or chmod? Let's say we build this image: FROMfrolvlad/alpine-miniconda3:python3.7 AS build# set working directoryWORKDIR/usr/src/app# copy codeCOPY ./code /codeCOPY ./notebooks /notebooks# add non-root userRUN addgroup –system user && \ adduser –system -G user user && \ chown -R user:user /usr/src/appAfter copying the code from the host machine to the container, we switch permissions for the working directory from root to user.
Today I've spent all my coding time on re-factoring my sqlite3 database to postgres. Nim and Jester (a web framework) ship with inbuilt sqlite3 features. I couldn't get them working within Docker. I know how to use Docker and Postgres. Plus, the wrapper library for Nim around SQL databases offers a consistent API. My re-factoring only needed minimal changes. The project is still in flux. And I have some annoying errors with Nim and SQL queries.
Today I learned that you can't bind-mount folders on your host machine into a Docker container during build. For local development, I bind-mount with docker-compose. Example: version: '2.4'services: url-shortener: build: context: ./services/url-shortener dockerfile: Dockerfile volumes: - './services/url-shortener:/usr/src/app:delegated' ports: - 5001:5000My goal was to use the language's package manager to install the required dependencies. Here's the Dockerfile: