Skip to content
Chris Patten edited this page Aug 3, 2016 · 6 revisions

Docker is a great way to run "containerized" applications easily and without installing additional requirements or dependencies on your computer. Additionally, it is designed so that if it works somewhere, it will work everywhere. No need to install Python 2.7 (if have Python 3.0 on your system, or just don't like Python)!

Prerequisites

Running

Clone the Repository

git clone https://github.com/AHAAAAAAA/PokemonGo-Map.git

Build the Image

The build instructions are located in the Dockerfile. It will build the image same way on my machine as it builds on yours. We KNOW it will work. This command creates a docker image called pogomap.

docker build -t pogomap PokemonGo-Map

A docker image is a read-only template you can spawn multiple containers off of. To run PokemonGo map multiple times, with multiple accounts, you use one (1) image, and have multiple containers using that SAME image.

Run a Container

Now that we have the read-only image created, we can run a version of it, called a "container". We will call this container pogomap-timessquare, although, you may call it whatever you like. Good naming conventions mean that you'll know what each container is doing.

docker run -it --rm -p 5000:5000 \
    --name pogomap-timessquare pogomap \
    -a ptc -u *USERNAME* -p *PASSWORD* \
    -k *GOOGLE-MAPS-API-KEY* \
    -l 'Times Square, Manhattan, NY 10036' \
    -st 5

The above command does the following:

  • run -it - Runs a container (instance) of the pogomap image called pogomap-timessquare.
  • -p 5000:5000 - Attaches port 5000 of the container to your computer on port 5000.
  • Passes all the command-line arguments as normal.

The map is being served off your computer's IP address on port 5000 (e.g. http://192.168.1.100:5000). On a Mac often it is http://192.168.99.100:5000/

Advanced Topics

Raspberry Pi

The Docker containers referenced will not work on ARM-based systems. You'll see things like exec format error and the docker build command will fail.

To get it working on your Raspberry Pi, you'll need to compile the base containers from scratch on your Pi, which is going to take quite some time.

Also, because Raspberry Pi's don't represent a large part of the Docker community, we'll need to make some manual updates to get things working.

Step 0

It's probably going to be easier to use screen to manage this process, as it will take a couple of hours.

sudo apt-get install screen

To use it, type screen. This will dump you into a new terminal that you can start and leave running in the background, even if you need to disconnect and reconnect at a different time.

While you're in the screen terminal, type ctrl-a d to disconnect. To resume the session and check the progress, type screen -r.

Step 1

First, we'll need to compile the python container on ARM.

This is going to take a long time!

curl https://gist.githubusercontent.com/ChrisMagellan/d9299b3100ef1089a2b0046bdb202243/raw docker-python-2.7-alpine-pi > docker-python-2.7-alpine-pi
docker build -t python-2.7-alpine-pi - < docker-python-2.7-alpine-pi

Step 2

Clone the repository (as described above)

Step 3

Edit Dockerfile in the repository to reference your custom Python container instead of the x86 version.

cd PokemonGo-Map
nano Dockerfile

Near the top of the file, change the line FROM python:2.7-alpine to FROM python-2.7-alpine-pi

Step 4

Build the Docker container as above. This will also take a long time!

Background Threads

Replace -it --rm with -d in the command line above to run it in the background so you can close the window.

  • View Logs - docker logs -f pogomap-timessquare. Press [Ctrl]+C to stop exit the view. This will not stop the running container.
  • Stop the Container - docker stop pogomap-timessquare

Start an SSL Tunnel (Unsupported)

You'll probably want to access this map from places other than your own computer; we will use ngrok.

Docker allows you to link the networks of multiple containers. We will use another image (wernight/ngrok) to make another container (ngrok-timessquare) and link it to our mapping container (pogomap-timesquare).

It seems over-engineered for our simple process, but it has huge benefits when we have more than 1 container running. :)

docker run -d -p 4040 \
   --link pogomap-timessquare \
   --name ngrok-timessquare wernight/ngrok \
    ngrok http pogomap-timessquare:5000
  • run -d - Run in the background
  • -p 4040 - Expose port 4040 for management
  • --link pogomap-timessquaare - Link to the pogomap-timessquare container
  • --name ngrok-timessquare - Name this container ngrok-timessquare

Discover ngrok URL

Now that ngrok tunnel is running, let's see what domain you've been assigned.

You can browse to port 4040 on your computer or query it from the command-line:

docker run --rm --link ngrok \
  appropriate/curl \
    sh -c "curl -s http://ngrok:4040/api/tunnels | grep -o 'https:\/\/[a-zA-Z0-9\.]\+'"

That should a string:

https://random-string-here.ngrok.io

Open that up and you're ready to rock!

Updating Versions

This project is being updated extremely frequently, be sure to always run the latest version.

# Stop the containers
docker stop ngrok-timesquare
docker stop pogomap-timessquare

# Remove the old pogomap-timessquare container
docker rm pogomap-timessquare

# Get the newest version
git pull

# Rebuild the image
docker build -t pogomap .

# Run the command you used to start your container initially.
docker run -it --rm -p 5000:5000 \
    --name pogomap-timessquare pogomap \
    -a ptc -u *USERNAME* -p *PASSWORD* \
    -k *GOOGLE-MAPS-API-KEY* \
    -l 'Times Square, Manhattan, NY 10036' \
    -st 5

# Restart the ngrok container
docker start ngrok-timessquare