run.sh 665 B

1234567891011121314151617
  1. #!/bin/bash
  2. # Check if there is a Docker image named "crawler"
  3. if ! sudo docker images | grep -w 'crawler' > /dev/null; then
  4. echo "Docker repository 'crawler' not found. Building the image..."
  5. # Build the Docker image with the name 'crawler'
  6. sudo docker build -t crawler .
  7. else
  8. echo "Docker image already built."
  9. fi
  10. # Ensure that init.sh script is executable
  11. sudo chmod +x ./data/init.sh
  12. # Starting docker, mount docker.sock to work with docker-in-docker function, mount data directory for input/output from container
  13. sudo docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v ./data:/home/data crawler bash -c "/home/data/init.sh"