Closed middleagedman closed 7 years ago
Thank you for this.
I have not used Docker a whole lot other than kicking some dev servers up, so forgive me.
This seems like a fairly small thing to use a Docker container for, could you explain the appeal please?
Unless you are a madman with 25+ bots... 😮
Who called madman? Here i am!
I prefer docker containers when I run code from other people. It sandboxes things so you dont have to comb through all the code or worry about things affecting your system. It's also good if you want to run a VPN inside of it and prevent IP leakage out your main interface (good for torrents, etc). Plus it's somewhat cross platform, so say Windows people don't need to install Python, dependencies, etc and can instead just docker pull (app) from the hub.
But yea, I'm sure you get the idea :)
On Wed, Aug 3, 2016, 5:51 PM Spencer Carstens notifications@github.com wrote:
Thank you for this.
I have not used Docker a whole lot other than kicking some dev servers up, so forgive me.
This seems like a fairly small thing to use a Docker container for, could you explain the appeal please?
Unless you are a madman with 25+ bots... 😮
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PokemonGoF/PokemonGo-Bot/issues/2549#issuecomment-237386011, or mute the thread https://github.com/notifications/unsubscribe-auth/ANAIScdKsfbCZrONx4JBHApFPmZQauKqks5qcQ1DgaJpZM4JcIDi .
Also docker provides some useful features like --restart=always and etc
What exactly is $(pwd)? Is it relative path to folder or absolute?
@ksawerykarwacki it's abs path to current folder.
@refast still doesn't work for me, getting error #2532 also mentioned in #2483
@ksawerykarwacki make sure you've read installation guide
pay attention to
pip2 install -r requirements.txt
@refast but which section because as I understand docker is linux on windows in my case so i should follow linux or windows installation or the one of docker?
@ksawerykarwacki You should follow windows section.
The point is that you should clone repo and install python with all requirements in windows env to build docker image.
In a perfect world you would just pull image by name and run it.
@ksawerykarwacki: @refast @middleagedman, I believe the issue may be encountered by users running docker toolbox on windows instead of docker for windows. The two handle vitalization differently and as such the volume directory mounting is different. Perhaps the wiki should be updated to reflect this as well.
From https://docs.docker.com/engine/tutorials/dockervolumes/
In addition to creating a volume using the -v flag you can also mount a directory from your Docker engine’s host into a container.
$ docker run -d -P --name web -v /src/webapp:/opt/webapp training/webapp python app.py
If you are using Docker Machine on Mac or Windows, your Docker Engine daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory.
So, you can mount files or directories on OS X using:
docker run -v /Users/<path>:/<container path> ...
On Windows, mount directories using:
docker run -v /c/Users/<path>:/<container path> ...
NOTE: For Windows docker users the path must originate from the c/Users folder, otherwise file permissions in the directory being mounted will not pass through.
And personally I have had more success changing utilizing the following docker file and run command structure. It allows me to designate the config file through the command to the .py via -cf.
Dockerfile
FROM python:2.7-onbuild
ARG timezone=Etc/UTC
RUN echo $timezone > /etc/timezone \
&& ln -sfn /usr/share/zoneinfo/$timezone /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata
RUN apt-get update \
&& apt-get install -y python-protobuf
VOLUME ["/usr/src/app/web","/usr/src/app/configs"]
ENTRYPOINT ["python", "pokecli.py"]
Docker Run
docker run --name=pgo-botname1 -v /c/Users/<username>/PokemonGo-Bot/web:/usr/src/app/web -v /c/Users/<username>PokemonGo-Bot/configs:/usr/src/app/configs -d -it pokemongo -cf configs/config-UsernameBasic.json
Mounting the /web volume allows all my dockers to deposit the user info being gathered into one central shared folder that can then be accessed by the web viewer.
I hope this is helpful
Could you also add the note from #2418 - where the data
dir needs to be mounted in for the location cache to work.
Cheers
I also suggested changes in #2437 to clarify the examples, run the web interface with nginx and some rtfm for mounting volumes between hosts and containers. Any chance this could get merged as well?
If I get time this week I'll create a docker image in docker hub and people who have docker can just docker pull it.
EDIT: Or actually maybe never, since it looks like the API has an AES hash in it now.. may never get the bot back working :*(
I cleaned up some of the Docker instructions with things I thought may be helpful for others.
For How-to-run-with-Docker.md
Start by downloading for your platform: Mac, Windows, or Linux. Once you have Docker installed, simply create the various config.json files for your different accounts (e.g.
configs/config-account1.json
) and then create a Docker image for PokemonGo-Bot using the Dockerfile in this repo.You can verify that the image was created with:
To run PokemonGo-Bot Docker image you've created, simple run:
To run PokemonGo-Bot Docker image in the background, replace
--rm
with-d
in the line above. Then check the logs with:docker logs -f pokemongobot-acct1
If you want to run multiple accounts with the same Docker image, simply specify different config.json and names in the Docker run command. Do not push your image to a registry with your config.json and account details in it!
If you would like to run the PokemonGo-Bot image and have it autoupdate the local OpenPoGoBotWeb directory, run:
Again, to run PokemonGo-Bot Docker image in the background, replace
--rm
with-d
in the line above.TODO: Add configuration for running multiple Docker containers from the same image for every bot instance, and a single container for the web UI.