Mistake on this page? Email us

Quick start with snapcraft behind a proxy

This supplemental guide contains alternative steps for building Pelion Edge with snapcraft packaging in an environment with no direct Internet access (all access is routed through a proxy).


In addition to the prerequisites for building without a proxy, you need:

  • A build machine (physical or VM) running a recent Ubuntu Linux version (such as Ubuntu 20.04) and a user with sudo rights.

  • Information about the proxy in the form protocol://proxy_user:[email protected]_host:proxy_port (for example http://myUser:[email protected]:8888).

    If you are setting up a test environment, we recommend you use Apache 2.4.48 or newer as a proxy.

Build Pelion Edge

  1. Set up the environment to use the proxy (replace the example proxy data in the first line below with the real details):

    export proxy="http://myUser:[email protected]:8888"
    export http_proxy="$proxy" https_proxy="$proxy"
    sudo snap remove docker
    sudo apt update
    sudo apt install -y git docker.io coreutils
    git config --global http.proxy "$proxy"
    sudo usermod -a -G docker $(whoami)
    cat <<-EOT >/tmp/http-proxy.conf
    sudo mkdir -p /etc/systemd/system/docker.service.d
    sudo mv /tmp/http-proxy.conf /etc/systemd/system/docker.service.d/
    sudo systemctl daemon-reload
    sudo systemctl restart docker
  2. Follow the steps from the snapcraft quick guide to clone the snap-pelion-edge repository and generate/copy the required credentials.

    DON'T run the quick start's last step (building commands) because the commands are different when using a proxy. Instead, use the step below.

  3. Build with the snapcraft Docker image:

    docker build --no-cache -f Dockerfile --label snapcore/snapcraft --tag ${USER}/snapcraft:latest --build-arg http_proxy=$proxy --build-arg https_proxy=$proxy .
    docker run --rm -v "$PWD":/build --env "http_proxy=$proxy" --env "https_proxy=$proxy" -w /build ${USER}/snapcraft:latest bash -c "sudo http_proxy=$proxy https_proxy=$proxy apt-get update && snapcraft --debug"