Something I picked up on a few days ago was using Docker’s –net-alias command (or docker-compose equivalent) for cheap and easy round robin load balancing.
For example, start two elasticsearch containers with –net-alias search and from within the network, using the ‘search’ as the DNS name for connecting, you’d get 1 of the 2 servers at random.
If for some reason you find yourself needing to use
nano in a Docker container, you can set the terminal type and then you’ll be able to use it. Say for example you ran
bash with the exec command, you can then run:
and it’ll allow you to use the terminal as normal for nano/clear etc.
This is the first post in a two part series detailing how you can use Docker to run local caches of both remote NPM resources and composer packages.
docker pull keyvanfatehi/sinopia
After the image has been pulled down, you can run it and map to a port using the following syntax:
docker run -p 81:4873 keyvanfatehi/sinopia
This will run sinopia and bind the external interface to port 81. There is a fair few configuration options that you can specify, I’d recommend getting a copy of the configuration file then mounting that as a volume.
Next, at the top of the screen, it’ll give you the two commands to make your client version of NPM connect to your new shiny cache, it’ll be something similar to:
If you run those two commands, it’ll set your client to use your new cache and you’re good to go.
The following links are useful reference for this post:
I download a lot of linux images, by far the quickest way is via torrent. Recently discovered a nice implementation of rtorrent in a Docker image, via docktorrent, simple enough to run:
docker run -itd
31405 is the public facing port for the web interface, make sure that you forward both
45566 as it’ll need those to run.