Search

Sunday 24 February 2019

Using Docker to run multiple instances of TinyProxy

  • install ubuntu 14.04 - 64 bit or later
  • Ideally set a static IP, gateway and Google DNS (8.8.8.8) before continuing
  • Go through Docker installation procedure https://docs.docker.com/engine/installation/linux/ubuntulinux/
  • Update package information, ensure that APT works with the https method, and that CA certificates are installed.
$ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates
  • Add the new GPG key.
$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
$ sudo nano /etc/apt/sources.list.d/docker.list
$ sudo apt-get update
  • Purge the old repo if it exists.
$ sudo apt-get purge lxc-docker
  • Verify that APT is pulling from the right repository.
$ apt-cache policy docker-engine
  • Prerequisites by Ubuntu Version¶ Ubuntu Xenial 16.04 (LTS) Ubuntu Wily 15.10 Ubuntu Trusty 14.04 (LTS) For Ubuntu Trusty, Wily, and Xenial, it’s recommended to install the linux-image-extra-* kernel packages. The linux-image-extra-* packages allows you use the aufs storage driver.
  • To install the linux-image-extra-* packages: Open a terminal on your Ubuntu host. Update your package manager.
$ sudo apt-get update Install the recommended packages. $ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
  • Install Make sure you have installed the prerequisites for your Ubuntu version.
  • Then, install Docker using the following:
  • Log into your Ubuntu installation as a user with sudo privileges. Update your APT package index.
$ sudo apt-get update
  • Install Docker
$ sudo apt-get install docker-engine
  • Start the docker daemon.
$ sudo service docker start
  • Verify docker is installed correctly.
$ sudo docker run hello-world
  • This command downloads a test image and runs it in a container. When the container runs, it prints an informational message. Then, it exits.
  • Find out what is running
$ sudo docker ps
  • Choose a container to download and from DockerHub - https://hub.docker.com/explore/
  • In our use case we require 'TinyProxy'
  • We can download and run the container with one command. At the same time we can specify the NIC and port we wish to bind our container to. You can run multiple containers on different IP's and ports.
  • In the example below we spawn a new tinyproxy instance with the unique name 'tinyproxy1' on the IP 10.0.2.200 and we map the internal docker port of 8080 to the published port of 9090.
$ sudo dcker run -d --name='tinyproxy1' -p 10.0.1.200:9090:8080 dannydirect/tinyproxy:latest ANY
  • You can spawn as many of these as your hardware permits, as long as they have a unique name, IP and port mapping

No comments:

Post a Comment