using docker

This commit is contained in:
soulgalore 2016-10-19 15:11:26 +02:00
parent dc26146ff8
commit 3f72ba1d2d
1 changed files with 23 additions and 12 deletions

View File

@ -1,14 +1,13 @@
---
layout: default
title: Docker - Documentation - sitespeed.io
description: Use Docker to run sitespeed.io.
title: Use Docker to run sitespeed.io.
description: With Docket you get a prebuilt container with sitespeed.io, Firefox, Chrome and XVFB.
keywords: docker, documentation, web performance, sitespeed.io
author: Peter Hedenskog
nav: documentation
image: https://www.sitespeed.io/img/sitespeed-2.0-twitter.png
twitterdescription: Use Docker to run sitespeed.io.
---
[Documentation]({{site.baseurl}}/documentation/sitespeed.io/) / Docker
[Documentation](/documentation/sitespeed.io/) / Docker
# Docker
{:.no_toc}
@ -21,12 +20,27 @@ With 4.0 we focus on one Docker container that you should use to run sitespeed.i
* [Chrome, Firefox & Xvfb](https://hub.docker.com/r/sitespeedio/sitespeed.io/)
It also contains FFMpeg, Imagemagick and some other things for the future to get SpeedIndex using [VisualMetrics](https://github.com/WPO-Foundation/visualmetrics).
## Running in Docker
The simplest way to run is like this fetching the box with Chrome and Firefox:
The simplest way to run is using Firefox:
~~~ bash
sudo docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io https://www.sitespeed.io -b chrome
$ docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io -b firefox https://www.sitespeed.io/
~~~
That will map the current directory inside Docker and output the result directory there.
If you wanna use Chrome you either need to use privileged or turn of the sandbox option:
~~~ bash
$ docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io -b chrome https://www.sitespeed.io/
~~~
or
~~~ bash
$ docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io -b chrome --browsertime.chrome.args no-sandbox https://www.sitespeed.io/
~~~
If you want to feed sitespeed with a list of URL:s in a file (here named *myurls.txt*), add the file to your current directory and do like this:
@ -38,19 +52,16 @@ sudo docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespee
In the real world you should always specify the exact version (tag) of the Docker container to make sure you use the same version all the time (else you will download the latest tag, meaning you can have old and new versions running on the server and you don't know it). Specify the tag after the container name(X.Y.Z) in this example. The tag/version number will be the same number as the sitespeed.io release:
~~~ bash
sudo docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:X.Y.Z https://www.sitespeed.io -b chrome
sudo docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:X.Y.Z https://www.sitespeed.io/ -b chrome
~~~
## Setup the volume
## More about volumes
If you want to feed sitespeed.io with a file with URL:s or if you want the HTML result, you should setup a volume. Sitespeed.io will do all the work inside the container in a directory located */sitespeed.io*. To setup your current working directory add the *-v "$(pwd)":/sitespeed.io* to your parameter list. Using "$(pwd)" will default to the root user directory. In order to specify the location, simply define an absolute path: *-v /Users/user/path:/sitespeed.io*
Note: running on Mac OS X and Windows Docker only has rights to write data in your */Users* or *C:\Users* directory. Read more [here](https://docs.docker.com/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume).
{: .note .note-warning}
## Update version (download newer sitespeed.io version)
## Update (download a newer sitespeed.io)
Updating to a newer version is easy, change X.Y.Z to the version you want to use:
~~~ bash