<% if @before_start -%> <%= @before_start %> <% end -%> <% if @remove_container_on_start -%> /usr/bin/<%= @docker_command %> rm <% if @remove_volume_on_start %>-v<% end %> <%= @sanitised_title %> >/dev/null 2>&1 <% end -%> <% if @pull_on_start -%> /usr/bin/<%= @docker_command %> pull <%= @image %> <% end -%> <% if @verify_digest -%> digest_local=$(docker image inspect <%= @image %> --format='{{index .RepoDigests 0}}') digest_verify="<%= @verify_digest %>" if [ "${digest_local##*:}" != "${digest_verify##*:}" ]; then echo "Digest verify failed! Expected checksum 'sha256:$digest_verify' does not match with local checksum 'sha256:$digest_local'!" exit 2 fi <% end -%> /usr/bin/<%= @docker_command %> create \ <%= @docker_run_flags %> \ --name <%= @sanitised_title %> \ <%= @image %> <% if @command %> \ <%= @command %><% end %> <% if @after_create %><%= @after_create %><% end %> <% if @net.is_a? Array%> <% @net.each do |n| %> /usr/bin/<%= @docker_command %> network connect <%= n %> <%= @sanitised_title %> <% end %> <% end %> /usr/bin/<%= @docker_command %> start <% if ! @valid_detach %>-a<% end %> <%= @sanitised_title %> <% if @after_start -%> <%= @after_start %> <% end -%>