0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-13 22:50:41 +00:00
wp-docker-buildx/DOCS.md

124 lines
4.0 KiB
Markdown
Raw Normal View History

2016-05-03 23:34:08 +00:00
Use the Docker plugin to build and push Docker images to a registry. The following parameters are used to configure this plugin:
2015-05-15 00:11:26 +00:00
2015-10-28 00:26:08 +00:00
* `registry` - authenticates to this registry
* `username` - authenticates with this username
* `password` - authenticates with this password
* `email` - authenticates with this email
* `repo` - repository name for the image
* `tag` - repository tag for the image
2016-01-11 10:03:31 +00:00
* `file` - dockerfile to be used, defaults to Dockerfile
* `context` - the context path to use, defaults to root of the git repo
2015-10-28 00:26:08 +00:00
* `insecure` - enable insecure communication to this registry
* `mirror` - use a mirror registry instead of pulling images directly from the central Hub
2015-11-27 21:30:33 +00:00
* `bip` - use for pass bridge ip
2016-01-11 10:03:31 +00:00
* `dns` - set custom dns servers for the container
2015-10-28 00:26:08 +00:00
* `storage_driver` - use `aufs`, `devicemapper`, `btrfs` or `overlay` driver
2016-05-03 23:34:08 +00:00
* `storage_path` - location of docker daemon storage on disk
2015-12-24 00:40:30 +00:00
* `build_args` - [build arguments](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables-build-arg) to pass to `docker build`
2015-05-15 00:11:26 +00:00
The following is a sample Docker configuration in your .drone.yml file:
```yaml
2015-10-08 15:54:10 +00:00
publish:
2015-05-15 00:11:26 +00:00
docker:
username: kevinbacon
2015-12-23 04:35:33 +00:00
password: pa55word
2015-05-15 00:11:26 +00:00
email: kevin.bacon@mail.com
repo: foo/bar
tag: latest
file: Dockerfile
2015-09-03 05:14:15 +00:00
insecure: false
```
2016-05-03 23:34:08 +00:00
Publish and image with multiple tags:
```yaml
publish:
docker:
username: kevinbacon
2015-12-23 04:35:33 +00:00
password: pa55word
email: kevin.bacon@mail.com
repo: foo/bar
tag:
- latest
2016-05-03 23:34:08 +00:00
- 1.0.1
- "1.0"
```
2016-05-03 23:34:08 +00:00
Build an image with arguments:
2015-12-24 00:40:30 +00:00
```yaml
publish:
docker:
username: kevinbacon
password: pa55word
email: kevin.bacon@mail.com
repo: foo/bar
build_args:
- HTTP_PROXY=http://yourproxy.com
```
## Caching
2016-01-03 15:55:01 +00:00
The Drone build environment is, by default, ephemeral meaning that you layers are not saved between builds. There are two methods for caching your layers.
### Graph directory caching
This is the preferred method when using the `overlay` or `aufs` storage drivers. Just use Drone's caching feature to backup and restore the directory `/drone/docker`, as shown in the following example:
```yaml
publish:
docker:
2016-05-03 23:34:08 +00:00
storage_path: /drone/docker
username: kevinbacon
password: pa55word
email: kevin.bacon@mail.com
repo: foo/bar
tag:
- latest
- "1.0.1"
cache:
mount:
- /drone/docker
```
2015-10-28 00:26:08 +00:00
## Troubleshooting
For detailed output you can set the `DOCKER_LAUNCH_DEBUG` environment variable in your plugin configuration. This starts Docker with verbose logging enabled.
```yaml
2015-10-28 00:26:08 +00:00
publish:
docker:
environment:
- DOCKER_LAUNCH_DEBUG=true
```
## Known Issues
There are known issues when attempting to run this plugin on CentOS, RedHat, and Linux installations that do not have a supported storage driver installed. You can check by running `docker info | grep 'Storage Driver:'` on your host machine. If the storage driver is not `aufs` or `overlay` you will need to re-configure your host machine.
This error occurs when trying to use the default `aufs` storage Driver but aufs is not installed:
```
level=fatal msg="Error starting daemon: error initializing graphdriver: driver not supported
```
This error occurs when trying to use the `overlay` storage Driver but overlay is not installed:
```
level=error msg="'overlay' not found as a supported filesystem on this host.
Please ensure kernel is new enough and has overlay support loaded."
2015-10-28 00:26:08 +00:00
level=fatal msg="Error starting daemon: error initializing graphdriver: driver not supported"
```
This error occurs when using CentOS or RedHat which default to the `devicemapper` storage driver:
2015-10-28 00:26:08 +00:00
```
level=error msg="There are no more loopback devices available."
level=fatal msg="Error starting daemon: error initializing graphdriver: loopback mounting failed"
2015-10-28 00:26:08 +00:00
Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
```
The above issue can be resolved by setting `storage_driver: vfs` in the `.drone.yml` file. This may work, but will have very poor performance as discussed [here](https://github.com/rancher/docker-from-scratch/issues/20).