Plugin Information |
---|
View docker-build-step on the plugin site for more information. |
If you would like to use Docker for dynamics slave provisioning, you should check this plugin.
Plugin currently support following commands:
- commit changes in specified container
- create new container from image
- create image from Dockerfile
- create exec command
- kill container(s)
- pull image from a repository
- push image to a repository
- remove container(s)
- remove all containers
- restart container(s)
- start container(s)
- stop container(s)
- stop all containers
- start/stop all containers created from specified image
- start exec command
Some commands also export build variables, so that you can easily use them in subsequent build steps.
Variables exported by create and start commands:
DOCKER_CONTAINER_IDS
- IDs of created/started containersDOCKER_IP_$HOSTNAME
- IP of running container with hostname$HOSTNAME
When port binding in set up (in start command), following environment variables are exported:
DOCKER_HOST_BIND_PORTS
- contains comma separated list of ports to which are bound docker container portsDOCKER_HOST_PORT_$SCHEMA_$PORT
- which docker container port is bound to this port (e.g.DOCKER_HOST_PORT_TCP_80
would contain value 8080 in case that container port 8080 is bound to port 80 on host)DOCKER_HOST_SOCKET_$SCHEMA_$PORT
- host IP:PORT to which conatiner$PORT
using$SCHEMA
is bound. E.g. with following port binding127.0.0.1:80:8080
, container TCP port is 8080 is bound to host port 80 on loopback andDOCKER_HOST_SOCKET_TCP_8080
will contain127.0.0.1:80
.
Known limitations: Commands run without any issue only on master, on remote slaves command execution fails, see JENKINS-24071 for details.
Configuration
You have to make sure that Docker service is running on slaves where you run the build. In Jenkins global configuration, you need to specify Docker REST API URL (typically somethig like http://127.0.0.1:2375) and select build steps you'd like to perform in your job configuration.
Changelog
Upcoming changes
Release 2.0 (2018-01-21)
- Command executed remotely on slave (pull52)
Release 1.43 (2017-06-09)
- Handle empty arguments in
CreateImageCommand
(pull49)
Release 1.42 (2017-05-22)
- Bump docker-java version to 3.0.10 (pull48)
Release 1.41 (2017-03-30)
- Added support for build-arg in
Create image
command (pull60)
Release 1.40 (2017-03-10)
Release 1.39 (2017-02-08)
- Expanded
tag
parameter inPush image
build step (pull53)
Release 1.38 (2017-01-18)
- Updated Apache
httpclient
version (pull44) - Support for specifying Docker file name in
Create image
build step (pull51)
Release 1.37 (2017-01-05)
- Upgrade to docker java 2.2.3 (pull41)
BACKWARD INCOMPATIBLE CHANGE: following options were moved (due to changes in underlyingdocker-java
library) fromStartConatinter
command toCreateContainer
command:publishAllPorts
portBindings
links
bindMounts
privileged
- Added several features (pull42)
- support for SSL
- always restart container policy
- extra hosts option (list of hostnames added to
/etc/hosts
)
- Wait for completion of some actions to make sure they succeeded (pull43)
- Upgrade to docker java 3.0.6 (pull45)
Release 1.36 (2017-01-05)
- broken release (as I forgot on INFRA-588)
Release 1.35 (2016-05-11)
- Fixed tag in
SaveImageCommnad
(issue #37)
Release 1.34 (2016-03-01)
- Support the post-build action in a multi-configuration project (pull40)
Release 1.33 (2015-11-19)
- Added force option to commands for container removal (pull39)
Release 1.32 (2015-10-30)
- Added force option for tag command (pull38)
- Improve description of config form fields (pull36) and display text (pull37)
Release 1.31 (2015-09-05)
- Upgrade
docker-commons
to 1.2 (pull35)
Release 1.30 (2015-08-28)
Release 1.29 (2015-08-14)
- Added missing Jelly file for
SaveImageCommand
(pull24)
Release 1.28 (2015-07-24)
Release 1.27 (2015-07-15)
- Added option to remove intermediate containers after a successful build to
Create image
command Docker URL
and version in global config can now contain environment variables
Release 1.26 (2015-06-26)
- Switch from custom Docker registry endpoint config to Docker commons plugin (pull32)
- Improved output in
CreateImageCommand
(pull19) - Added
SaveImageCommand
andRemoveImageCommand
(pull19)
Release 1.25 (2015-06-05)
- Added option for removing volumes when removing container (pull31)
Release 1.24 (2015-05-07)
- Intorduced new command combining
create
andstart exec
commands (pull30) - Show in the build log stream response from Docker in
start exec
command (pull30)
Release 1.23 (2015-04-28)
- Expanded env. variables in commit command (pull29)
Release 1.22 (2015-04-07)
- Added possibility to capture container log - currently works only for containers with TTY disabled (pull28)
- Added post build step to stop and remove Docker containers (pull27)
- Built with JDK6 support - docker-java library rebuilt with JDK6 support (JENKINS-27821)
Release 1.21 (2015-03-11)
- Added option for CPU and memory limits when creating container (pull26)
- Host
IP:PORT
to which some container port is bound is now exported asDOCKER_HOST_SOCKET_$SCHEMA_$PORT
(pull25)
Release 1.20 (2015-02-27)
- Added exposed ports option to CreateContainerCommand (pull24)
Release 1.19 (2015-02-23)
- Exec create and exec start commands
- Fixed issue with authnetication (pull23)
Release 1.18 (2015-01-19)
- Added option to ignore nonexistent containers IDs when removing the containers (pull8).
Release 1.17 (2015-01-07)
- Added Push command (pull22)
- Added registry authentication (JENKINS-24388)
- Improved Pull image command (JENKINS-26166, JENKINS-26167)
Release 1.16 (2014-12-05)
- Pull image cmd broken in rel. 1.15 (JENKINS-25929)
Release 1.15 (2014-12-04)
- Jenkins plugins class loader is now passed into docker-java client
- Allow "no-cache" option in Create Image step (JENKINS-25835)
- Added option for links when creating a container
- Added option for specifying links when starting a container (JENKINS-25796)
- Option for specifying container name when created container
Release 1.14 (2014-11-25)
- Ensure
DOCKER_CONTAINER_IDS
contains unique IDs (JENKINS-25745)
Release 1.13 (2014-11-06)
Release 1.12 (2014-10-24)
- Support for bind mounts (volumes) (JENKINS-24683)
Release 1.11 (2014-10-01)
- Added EnvVars option in Create container command (pull14)
- Fixed invalid version information in Docker URL (JENKINS-24551)
Release 1.10 (2014-09-19)
- Upgrade to docker-java 0.10.0 (pull13)
- Create image build step fails with Jenkins prior to 1.553 (JENKINS-24699) - requires Jenkins core 1.554.1 or higher
Release 1.9 (2014-08-21)
- Added env. variables with port bindings (JENKINS-23704)
- Execute Docker commands remotely on slaves (actually wasn't fixed, see JENKINS-24071)
Release 1.8 (2014-08-15)
- Added more options for Start container command - publish all ports and privileged option (pull10)
- Added option for Docker client version (JENKINS-24156)
- Switch to Docker syntax for port binding, backward incompatible change, see JENKINS-23704 for details (pull7)
Release 1.7 (2014-08-06)
- Removed placeholder text from index page (pull4)
- Allow admin to save global config page even if Docker URL is empty (JENKINS-23733)
- Added option for specifying port mapping when the container is started (JENKINS-23704)
- Expand env. variables in "wait for ports" field (JENKINS-24043)
- Don't use JDK7 methods (JENKINS-24041)
- Command is optional on container creation (pull5)
Release 1.6 (2014-06-17)
- Compatibility with Docker 1.0 (switch to com.github.docker-java)
Release 1.5 (2014-06-07)
- Check, if Docker URL was provided and Docker client initialized (JENKINS-23342)
- Validation button for Docker URL in global configuration (JENKINS-23343)
Release 1.4 (2014-05-28)
- Upgrade to latest docker-java - covers latest Docker REST API + number of bug fixes (JENKINS-23200,JENKINS-22838)
Release 1.3 (2014-05-21)
- Allow variable expansion in command parameters (JENKINS-23025)
- Fixed typos (pull3)
Release 1.2 (2014-04-06)
- Improved logging during building image from Docker file (JENKINS-22083/pull2)
- Wait for specified ports when starting containers (optional)
Release 1.1 (2014-03-06)
- Start and stop all containers created from specified image
- Pulling image from a repository
- Commit changes in specified container
- Create image from Dockerfile (pull1)
Release 1.0 (2014-02-17)
- Initial release