From 6944505e75aee39058eb2567f872c3416ca3fd60 Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Wed, 29 Apr 2015 18:28:47 +0300 Subject: [PATCH] Adds force docker service start Despite being started via upstart in rare cases docker service wasn't available on VM first boot. This commit adds force server star step Change-Id: I6fb0d247a4333c9444629c23dbc259de12f05805 Closes-Bug: #1449510 --- .../package/Classes/DockerStandaloneHost.yaml | 4 ++- .../package/Resources/StartDocker.template | 31 +++++++++++++++++++ .../package/Resources/scripts/startDocker.sh | 14 +++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 Docker/DockerStandaloneHost/package/Resources/StartDocker.template create mode 100644 Docker/DockerStandaloneHost/package/Resources/scripts/startDocker.sh diff --git a/Docker/DockerStandaloneHost/package/Classes/DockerStandaloneHost.yaml b/Docker/DockerStandaloneHost/package/Classes/DockerStandaloneHost.yaml index a70f5998..22f5fe8f 100644 --- a/Docker/DockerStandaloneHost/package/Classes/DockerStandaloneHost.yaml +++ b/Docker/DockerStandaloneHost/package/Classes/DockerStandaloneHost.yaml @@ -62,10 +62,12 @@ Methods: Then: - $._environment.reporter.report($this, 'Create VM for Docker Server') - $.instance.deploy() + - $resources: new(sys:Resources) + - $template: $resources.yaml('StartDocker.template') + - $.instance.agent.call($template, $resources) - If: $.dockerRegistry != null and $.dockerRegistry != '' Then: - $._environment.reporter.report($this, 'Configuring Docker registry') - - $resources: new(sys:Resources) - $template: $resources.yaml('SetupDockerRegistry.template').bind(dict( dockerRegistry => $.dockerRegistry )) diff --git a/Docker/DockerStandaloneHost/package/Resources/StartDocker.template b/Docker/DockerStandaloneHost/package/Resources/StartDocker.template new file mode 100644 index 00000000..4f7ea321 --- /dev/null +++ b/Docker/DockerStandaloneHost/package/Resources/StartDocker.template @@ -0,0 +1,31 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Start docker service + +Parameters: + image: $image + +Body: | + startDocker() + +Scripts: + startDocker: + Type: Application + Version: 1.0.0 + EntryPoint: startDocker.sh + Options: + captureStdout: false + captureStderr: false + verifyExitcode: false diff --git a/Docker/DockerStandaloneHost/package/Resources/scripts/startDocker.sh b/Docker/DockerStandaloneHost/package/Resources/scripts/startDocker.sh new file mode 100644 index 00000000..e64e325e --- /dev/null +++ b/Docker/DockerStandaloneHost/package/Resources/scripts/startDocker.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +service docker start \ No newline at end of file