The most basic profile, docker-batch, creates instances that do not have any access to the internet.
To have access to it, you must use the docker-network (or one of its children, such as docker-network-ssh) profile instead.
Below is a minimal example of a task that will download the Sadi Carnot page on wikipedia and count the number of lines in the HTML document.
Python
import qarnot
conn = qarnot.Connection(client_token='<<< MY_SECRET_TOKEN >>>')
task = conn.create_task("Hello World - Network", "docker-network", 1)
task.results = conn.create_bucket("network-out")
task.constants["DOCKER_REPO"] = "qarnotlab/network-example"
task.constants["DOCKER_TAG"] = "latest"
task.constants["DOCKER_CMD"] = "/bin/sh -c "\
"'curl https://en.wikipedia.org/wiki/Nicolas_Léonard_Sadi_Carnot"\
"| wc -l | tee nb_lines'"
task.run()
#! Bash
#!/bin/bash
# Your info
export QARNOT_CLIENT_TOKEN="<<<MY_SECRET_TOKEN>>>"
# Create an output bucket
qarnot bucket create \
--name network-out
# Create and run task
qarnot task create \
--name "Hello World - Network" \
--profile docker-network \
--instance 1 \
--result network-out \
--constants \
"DOCKER_REPO=qarnotlab/network-example" \
"DOCKER_TAG=latest" \
$'DOCKER_CMD=/bin/sh -c \"curl https://en.wikipedia.org/wiki/Nicolas_Léonard_Sadi_Carnot | wc -l | tee nb_lines\"'When starting such an instance, you may although receive an error: qarnot.exceptions.NotEnoughCreditsException: Not enough credits. It might be because you did not fill in your Billing Address. Unlike profiles for batch, profiles with access to the internet require a billing address.Beware! When an instance with access to the internet is started, it is invoiced from its start, even if it is cancelled or preempted. If you are using worker-type instances, don't forget to shut them down.