Skip to content

Creating and running Docker image

Coşkun Deniz edited this page Nov 27, 2023 · 2 revisions

How to create Docker image manually

Install docker from here.

Run the following commands in the project directory.

  • Build Docker image

    • docker build -t ad_clicker_docker .
  • Create a volume for the input files

    • docker volume create ad_clicker_files
  • Add your queries and proxies files to image volume

    • docker run -v ad_clicker_files:/data -v <queries.txt folder path>:/mnt/host alpine cp /mnt/host/queries.txt /data/

    • docker run -v ad_clicker_files:/data -v <proxies.txt folder path>:/mnt/host alpine cp /mnt/host/proxies.txt /data/

    • Check if the files are copied successfully

      • docker run --rm -v ad_clicker_files:/data alpine ls -l /data
      -rw-r--r--    1 root     root           165 Apr  1 09:25 proxies.txt
      -rw-r--r--    1 root     root           216 Apr  1 09:25 queries.txt
  • If you want to create a tar file and use on other systems by loading it, run the following command

    • docker save ad_clicker_docker:latest | gzip > ad_clicker_docker.tar.gz

    • Loading the tar image on another system

      • docker load -i ad_clicker_docker.tar.gz
      • docker volume create ad_clicker_files
    • Copy queries and proxies files to image volume explained in the previous step

How to run Docker image

  • Run the following command on your host machine once.

    • xhost local:docker
  • You can pass the arguments as before after the image name(in this case ad_clicker_docker)

    • docker run --rm -it --net=host -e DISPLAY=$DISPLAY -v ad_clicker_files:/data ad_clicker_docker run_ad_clicker.py -qf /data/queries.txt --auth -pf /data/proxies.txt -bc 2

    • docker run --rm -it --net=host -e DISPLAY=$DISPLAY ad_clicker_docker ad_clicker.py -q "wireless keyboard" -p username:password@host:port --auth