Pepcli with Docker for MacOS
The pepcli
application is a command line interface (CLI) application to interact with the PEP system. With pepcli
you can download and upload your data. There are several ways to use this application. Windows users can use the Windows Installer that is available from the website. Linux users can use the Flatpak binary. MacOS and *nix users can use pepcli with docker
. Docker is software that provides the ability to package and run an application in an isolated environment called a container. This tutorial explains how to use pepcli with Docker under Mac OS / OS X.
What you need before starting:
- A system that lets you use Docker, e.g. MacOS, Linux, etc.
- A PEP token (provided by the repository's Access Administrator)
HOWTO
Installing Docker for Mac OS
- Download Docker Desktop application at Docker.com. Make sure to choose the software with the right CPU architecture.
-
Open the
docker.dmg
file. Drag the docker app into your Application folder. Now the installation of Docker Desktop starts. -
After this, open the Docker Desktop application to finish the installation process. When the app opens for the first time, you have to set some configurations:
- Accept the service agreement
- Use recommended settings
- Choose continue without signing in
- You may skip the question about what kind of work you do
Now the Docker installation is complete. You can now close the installer application.
Using Docker (Mac OS, Windows, Linux, ...)
When running an application inside a docker container (which is how Docker works), communication between your container and your host machine (your computer outside the container) is by default disabled.
However you do need to have that line of communication, since the pepcli inside the container needs a token on your machine to be able to log in. And in order to use the data that you downloaded inside your container, you need to get it out of your docker container as well. So you can create so called bind mounts
(using the --volume
arguments in the next step), which means that a folder on your host machine is connected with a folder in the docker container. First you have to create these folders:
- Open a terminal window. Now create a new folder, e.g.
oauth_token
, then move the token file (e.g.OAuthToken.json
) you received from the repository's Access Administrator to this folder.
mkdir oauth_token
mv /Path/To/OAuthToken.json ./oauth_token
- Where /Path/To/
should be replaced with the current path of your token, and OAuthToken.json
with your token name.
- Create a new folder, e.g.
data_output
, in which you can later find the downloaded data.
mkdir data_output
- Now you can start running the Docker container with the following command:
docker run -it --volume /Path/To/data_output:/output \
--volume /Path/To/oauth_token:/token:ro <IMAGE_URI> bash
- Where Path/To/data_output
is the path to the data_output
folder you just created.
- Where Path/To/oauth_token
is the path to the oauth_token
folder where your token is located in.
- Where <IMAGE_URI>
is the URI of the Docker image. Depending on the project and environment you will be working in, you will need a different Docker image URI, you can find these here.
- Now you are in a shell inside a docker container. You can run the following command to download the data that you have access to:
cd /output
/app/pepcli --client-working-directory /config \
--oauth-token /token/OAuthToken.json pull \
--all-accessible
- Where and OAuthToken.json
should be replaced with your token name.
You can now find all your downloaded data in the output_data
folder that you made in step 5.
Here you see an example in a terminal:
For more details on how to use the pepcli, go here: Using pepcli.