Docker with remote servers

2025 update: Use docker contexts instead.

Original post:

If you’re running Docker without TLS (hopefully never in production, for dev only), set DOCKER_HOST to host-ip:2375 and should should be good to go:

export DOCKER_HOST=tcp://host-ip:2375

If you’re using TLS certs, point to 2376 on the remote machine and specify a path to the certs:

export DOCKER_HOST=tcp://host-ip:2376
export DOCKER_CERT_PATH=/path/to/certs

Pass the –tlsverify param to ensure certs are passed with command:

docker --tlsverify command

Use docker-compose against a remote machine with TLS certs:

docker-compose -H remote-server-ip:2376 --tlscacert ca.pem --tlscert cert.pem --tlskey key.pem -f docker-compose.yml up

How to setup your Docker server to use TLS certs is here: https://docs.docker.com/engine/security/https/

2 years later: 2 years of running WordPress and MySQL on Docker in a VPS

It’s been 2 years since I migrated this site from a native install on a VPS to another VPS running Docker. I covered my migration in a number of posts, the first of which is here:

The surprising thing (maybe? maybe not?) is that the site has been up and running for the past 2 years with no issues. I think I rebooted the VPS a couple of times for reasons I can’t remember, but other than that the site’s been up reliably for the past 2 years.

It’s also been 2 years since I last renewed my SSL certificate, so time to do a couple of updates. More to come later.

Why does the C programming language (and other C-like languages) have pre and post operators?

This is an interesting question that has a common answer that turns out to be a myth/historically incorrect.

TLDR; the definitive answer to this question comes from Dennis Ritchie himself, developer of the C language in his article “The Development of the C Language” – http://www.bell-labs.com/usr/dmr/www/chist.html 

“Thompson went a step further by inventing the ++ and — operators, which increment or decrement; their prefix or postfix position determines whether the alteration occurs before or after noting the value of the operand. They were not in the earliest versions of B, but appeared along the way. People often guess that they were created to use the auto-increment and auto-decrement address modes provided by the DEC PDP-11 on which C and Unix first became popular. This is historically impossible, since there was no PDP-11 when B was developed. The PDP-7, however, did have a few `auto-increment’ memory cells, with the property that an indirect memory reference through them incremented the cell. This feature probably suggested such operators to Thompson; the generalization to make them both prefix and postfix was his own. Indeed, the auto-increment cells were not used directly in implementation of the operators, and a stronger motivation for the innovation was probably his observation that the translation of ++x was smaller than that of x=x+1.

From http://www.bell-labs.com/usr/dmr/www/chist.html

The common answer which turns out to be incorrect is (paraphrasing) “C has pre and post operators because C was developed on the PDP-11 and this machine had pre and post CPU instructions, the implementation of ++ and — in C used these machine instructions”.

The explanation from Ritchie that corrects this misconception:

“People often guess that they were created to use the auto-increment and auto-decrement address modes provided by the DEC PDP-11 on which C and Unix first became popular. This is historically impossible, since there was no PDP-11 when B was developed”

From: http://www.bell-labs.com/usr/dmr/www/chist.html

An interesting piece of computing history.