github.com/mika/distribution@v2.2.2-0.20160108133430-a75790e3d8e0+incompatible/contrib/docker-integration/README.md (about)

     1  # Docker Registry Integration Testing
     2  
     3  These integration tests cover interactions between the Docker daemon and the
     4  registry server. All tests are run using the docker cli.
     5  
     6  The compose configuration is intended to setup a testing environment for Docker
     7  using multiple registry configurations. These configurations include different
     8  combinations of a v1 and v2 registry as well as TLS configurations.
     9  
    10  ## Running inside of Docker
    11  ### Get integration container
    12  The container image to run the integation tests will need to be pulled or built
    13  locally.
    14  
    15  *Building locally*
    16  ```
    17  $ docker build -t distribution/docker-integration .
    18  ```
    19  
    20  ### Run script
    21  
    22  Invoke the tests within Docker through the `run.sh` script.
    23  
    24  ```
    25  $ ./run.sh
    26  ```
    27  
    28  Run with aufs driver and tmp volume
    29  **NOTE: Using a volume will prevent multiple runs from needing to
    30  re-pull images**
    31  ```
    32  $ DOCKER_GRAPHDRIVER=aufs DOCKER_VOLUME=/tmp/volume ./run.sh
    33  ```
    34  
    35  ### Example developer flow 
    36  
    37  These tests are useful for developing both as a registry and docker
    38  core developer. The following setup may be used to do integration
    39  testing between development versions
    40  
    41  Insert into your `.zshrc` or `.bashrc`
    42  
    43  ```
    44  # /usr/lib/docker for Docker-in-Docker
    45  # Set this directory to make each invocation run much faster, without
    46  # the need to repull images.
    47  export DOCKER_VOLUME=$HOME/.docker-test-volume
    48  
    49  # Use overlay for all Docker testing, try aufs if overlay not supported
    50  export DOCKER_GRAPHDRIVER=overlay
    51  
    52  # Name this according to personal preference
    53  function rdtest() {
    54    if [ "$1" != "" ]; then
    55      DOCKER_BINARY=$GOPATH/src/github.com/docker/docker/bundles/$1/binary/docker
    56      if [ ! -f $DOCKER_BINARY ]; then
    57        current_version=`cat $GOPATH/src/github.com/docker/docker/VERSION`
    58        echo "$DOCKER_BINARY does not exist"
    59        echo "Current checked out docker version: $current_version"
    60        echo "Checkout desired version and run 'make binary' from $GOPATH/src/github.com/docker/docker"
    61        return 1
    62      fi
    63    fi
    64  
    65    $GOPATH/src/github.com/docker/distribution/contrib/docker-integration/run.sh
    66  }
    67  ```
    68  
    69  Run with Docker release version
    70  ```
    71  $ rdtest
    72  ```
    73  
    74  Run using local development version of docker
    75  ```
    76  $ cd $GOPATH/src/github.com/docker/docker
    77  $ make binary
    78  $ rdtest `cat VERSION`
    79  ```
    80  
    81  ## Running manually outside of Docker
    82  
    83  ### Install Docker Compose
    84  
    85  [Docker Compose Installation Guide](https://docs.docker.com/compose/install/)
    86  
    87  ### Start compose setup
    88  ```
    89  docker-compose up
    90  ```
    91  
    92  ### Install Certificates
    93  The certificates must be installed in /etc/docker/cert.d in order to use TLS
    94  client auth and use the CA certificate.
    95  ```
    96  sudo sh ./install_certs.sh
    97  ```
    98  
    99  ### Test with Docker
   100  Tag an image as with any other private registry. Attempt to push the image.
   101  
   102  ```
   103  docker pull hello-world
   104  docker tag hello-world localhost:5440/hello-world
   105  docker push localhost:5440/hello-world
   106  
   107  docker tag hello-world localhost:5441/hello-world
   108  docker push localhost:5441/hello-world
   109  # Perform login using user `testuser` and password `passpassword`
   110  ```
   111  
   112  ### Set /etc/hosts entry
   113  Find the non-localhost ip address of local machine
   114  
   115  ### Run bats
   116  Run the bats tests after updating /etc/hosts, installing the certificates, and
   117  running the `docker-compose` script.
   118  ```
   119  bats -p .
   120  ```
   121  
   122  ## Configurations
   123  
   124  Port | V2 | V1 | TLS | Authentication
   125  --- | --- | --- | --- | ---
   126  5000 | yes | yes | no | none
   127  5001 | no | yes | no | none
   128  5002 | yes | no | no | none
   129  5011 | no | yes | yes | none
   130  5440 | yes | yes | yes | none
   131  5441 | yes | yes | yes | basic (testuser/passpassword)
   132  5442 | yes | yes | yes | TLS client
   133  5443 | yes | yes | yes | TLS client (no CA)
   134  5444 | yes | yes | yes | TLS client + basic (testuser/passpassword)
   135  5445 | yes | yes | yes (no CA) | none
   136  5446 | yes | yes | yes (no CA) | basic (testuser/passpassword)
   137  5447 | yes | yes | yes (no CA) | TLS client
   138  5448 | yes | yes | yes (SSLv3) | none