Link with Docker
Setting up mabl Link with Docker removes the need of installing Java and setting up the Java-based Link Agent distribution on the host machine. Instead, you can run the Link Agent inside a Docker container. You can get the Link Agent Docker image from the Dockerhub.
To run the Link Agent inside a Docker container, use the following command.
$ docker run mablhq/link-agent --api-key <your-api-key> --name <agent-name>
Alternatively you can run the container as a background daemon process in the following way:
$ docker run -d --name mabl-link-agent mablhq/link-agent \
--api-key <your-api-key> --name <agent-name>
Once you run the Docker container, go to Using mabl Link - Step 4 to proceed with the rest of the Link service setup.
Testing against 'localhost'
By default the Docker container will resolve localhost
to the guest (i.e. the container itself) rather than the host (i.e. the machine running Docker). If your test needs to access services running on the docker host, such as localhost
URLs, you will need to take additional steps that are specific to your host operating system. Find the instructions below for your OS.
Testing against 'localhost' on Linux hosts
If Docker is running on a Linux system, add the following argument after docker run
: --net="host"
. For example:
$ docker run --net="host" mablhq/link-agent --api-key <your-api-key> --name <agent-name>
The next step involves creating an alias for localhost
because most browsers will not allow proxying requests to localhost
. Edit your /etc/hosts
file, and look for a line like the following:
127.0.0.1 localhost
Choose an alias for localhost
, such as link-host
(or choose your own name), and add it to the end of the line. The new line should look like this:
127.0.0.1 localhost link-host
Finally, update your environment URLs in mabl to use link-host
instead of localhost
. For example, if your URL is http://localhost:3000
the new URL should be http://link-host:3000
.
Testing against 'localhost' on OSX hosts
To test against localhost
on OSX, the only change that needs to occur is to update the URL in your mabl environment. Instead of localhost
, use host.docker.internal
. For example, if your URL was http://localhost:3000
, use http://host.docker.internal:3000
instead.
Updated 7 months ago