2022-07-06 06:08:45 +00:00
< page-header title = "'Create container'" breadcrumbs = "[{label:'Containers', link:'docker.containers'}, 'Add container']" > < / page-header >
2016-07-06 00:19:09 +00:00
2020-08-07 02:10:40 +00:00
< information-panel title-text = "Caution" ng-if = "state.mode == 'duplicate'" >
< span class = "small" >
< p class = "text-muted" >
2022-11-28 02:00:28 +00:00
< pr-icon icon = "'alert-triangle'" mode = "'warning'" class-name = "'mr-0.5'" > < / pr-icon >
2020-08-07 02:10:40 +00:00
The new container may fail to start if the image is changed, and settings from the previous container aren't compatible. Common causes include entrypoint, cmd or
2022-12-18 08:13:18 +00:00
< a href = "https://docs.portainer.io/user/docker/containers/advanced" target = "_blank" > other settings< / a > set by an image.
2020-08-07 02:10:40 +00:00
< / p >
< / span >
< / information-panel >
2016-07-06 00:19:09 +00:00
< div class = "row" >
< div class = "col-lg-12 col-md-12 col-xs-12" >
< rd-widget >
< rd-widget-body >
2017-11-20 13:34:14 +00:00
< form class = "form-horizontal" autocomplete = "off" >
2016-07-06 00:19:09 +00:00
<!-- name - input -->
< div class = "form-group" >
2023-03-03 01:47:10 +00:00
< label for = "container_name" class = "col-sm-3 col-lg-2 control-label text-left" > Name< / label >
< div class = "col-sm-8" >
2020-04-10 21:54:53 +00:00
< input type = "text" class = "form-control" ng-model = "config.name" id = "container_name" placeholder = "e.g. myContainer" / >
2016-07-06 00:19:09 +00:00
< / div >
< / div >
<!-- !name - input -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Image configuration < / div >
2019-11-27 22:36:39 +00:00
< div ng-if = "!formValues.RegistryModel.Registry && fromContainer" >
2022-11-28 02:00:28 +00:00
< pr-icon icon = "'alert-triangle'" mode = "'warning'" > < / pr-icon >
2022-01-17 05:53:32 +00:00
< span class = "small text-danger" style = "margin-left: 5px" >
2021-03-24 18:27:32 +00:00
The Docker registry for the < code > {{ config.Image }}< / code > image is not registered inside Portainer, you will not be able to create a container. Please register that
registry first.
< / span >
2016-07-06 00:19:09 +00:00
< / div >
2019-11-27 22:36:39 +00:00
< div ng-if = "formValues.RegistryModel.Registry || !fromContainer" >
2017-09-05 14:42:20 +00:00
<!-- image - and - registry -->
2018-07-03 18:31:02 +00:00
< por-image-registry
2019-11-27 22:36:39 +00:00
model="formValues.RegistryModel"
ng-if="formValues.RegistryModel.Registry"
2018-07-03 18:31:02 +00:00
auto-complete="true"
2021-03-24 18:27:32 +00:00
endpoint="endpoint"
is-admin="isAdmin"
check-rate-limits="formValues.alwaysPull"
2022-08-12 04:47:44 +00:00
on-image-change="onImageNameChange()"
2021-03-24 18:27:32 +00:00
set-validity="setPullImageValidity"
>
<!-- always - pull -->
< div class = "form-group" >
< div class = "col-sm-12" >
2022-07-20 00:39:44 +00:00
< por-switch-field
name="'alwaysPull'"
label-class="'col-sm-2'"
checked="formValues.alwaysPull"
disabled="!state.pullImageValidity"
label="'Always pull the image'"
on-change="(onAlwaysPullChange)"
tooltip="'When enabled, Portainer will automatically try to pull the specified image before creating the container.'"
>< / por-switch-field >
2021-03-24 18:27:32 +00:00
< / div >
2017-09-05 14:42:20 +00:00
< / div >
2021-03-24 18:27:32 +00:00
<!-- !always - pull -->
< / por-image-registry >
<!-- !image - and - registry -->
2017-03-27 12:44:39 +00:00
< / div >
2022-08-12 04:47:44 +00:00
2022-02-14 13:51:43 +00:00
<!-- create - webhook -->
< div ng-if = "isAdmin && applicationState.endpoint.type !== 4" >
< div class = "col-sm-12 form-section-title" > Webhooks < / div >
< div class = "form-group" >
< div class = "col-sm-12" >
2022-07-20 00:39:44 +00:00
< por-switch-field
feature-id="'container-webhook'"
label-class="'col-sm-2'"
label="'Create a container webhook'"
tooltip="'Create a webhook (or callback URI) to automate the recreate this container. Sending a POST request to this callback URI (without requiring any authentication) will pull the most up-to-date version of the associated image and recreate this container.'"
>< / por-switch-field >
2022-02-14 13:51:43 +00:00
< / div >
< / div >
< / div >
<!-- !create - webhook -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Network ports configuration < / div >
2017-03-27 12:44:39 +00:00
<!-- publish - exposed - ports -->
< div class = "form-group" >
< div class = "col-sm-12" >
2022-07-20 00:39:44 +00:00
< por-switch-field
label-class="'col-sm-2'"
checked="config.HostConfig.PublishAllPorts"
label="'Publish all exposed network ports to random host ports'"
on-change="(handlePublishAllPortsChange)"
tooltip="'When enabled, Portainer will let Docker automatically map a random port on the host to each one defined in the image Dockerfile.'"
>< / por-switch-field >
2016-07-06 00:19:09 +00:00
< / div >
< / div >
2017-03-27 12:44:39 +00:00
<!-- !publish - exposed - ports -->
2016-07-06 00:19:09 +00:00
<!-- port - mapping -->
< div class = "form-group" >
2017-03-27 12:44:39 +00:00
< div class = "col-sm-12" >
2019-10-15 09:13:57 +00:00
< label class = "control-label text-left" >
Manual network port publishing
2020-04-10 21:54:53 +00:00
< portainer-tooltip
2022-07-03 23:21:25 +00:00
message="'When a range of ports on the host and a single port on the container is specified, Docker will randomly choose a single available port in the defined range and forward that to the container port.'"
2020-04-10 21:54:53 +00:00
>< / portainer-tooltip >
2019-10-15 09:13:57 +00:00
< / label >
2022-01-17 05:53:32 +00:00
< span class = "label label-default interactive" style = "margin-left: 10px" ng-click = "addPortBinding()" >
2022-11-28 02:00:28 +00:00
< pr-icon icon = "'plus'" mode = "'alt'" > < / pr-icon > publish a new network port
2016-07-06 00:19:09 +00:00
< / span >
< / div >
<!-- port - mapping - input - list -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-inline" style = "margin-top: 10px" >
< div ng-repeat = "portBinding in config.HostConfig.PortBindings" style = "margin-top: 2px" >
2017-03-27 12:44:39 +00:00
<!-- host - port -->
< div class = "input-group col-sm-4 input-group-sm" >
2016-07-06 00:19:09 +00:00
< span class = "input-group-addon" > host< / span >
2020-04-10 21:54:53 +00:00
< input type = "text" class = "form-control" ng-model = "portBinding.hostPort" placeholder = "e.g. 80, 80-88, ip:80 or ip:80-88 (optional)" / >
2016-07-06 00:19:09 +00:00
< / div >
2017-03-27 12:44:39 +00:00
<!-- !host - port -->
2022-01-17 05:53:32 +00:00
< span style = "margin: 0 10px 0 10px" >
2022-11-28 02:00:28 +00:00
< pr-icon icon = "'arrow-right'" > < / pr-icon >
2017-03-27 12:44:39 +00:00
< / span >
<!-- container - port -->
< div class = "input-group col-sm-4 input-group-sm" >
2016-07-06 00:19:09 +00:00
< span class = "input-group-addon" > container< / span >
2020-04-10 21:54:53 +00:00
< input type = "text" class = "form-control" ng-model = "portBinding.containerPort" placeholder = "e.g. 80 or 80-88" / >
2016-07-06 00:19:09 +00:00
< / div >
2017-03-27 12:44:39 +00:00
<!-- !container - port -->
<!-- protocol - actions -->
< div class = "input-group col-sm-3 input-group-sm" >
< div class = "btn-group btn-group-sm" >
2022-08-12 04:47:44 +00:00
< label class = "btn btn-light" ng-model = "portBinding.protocol" uib-btn-radio = "'tcp'" > TCP< / label >
< label class = "btn btn-light" ng-model = "portBinding.protocol" uib-btn-radio = "'udp'" > UDP< / label >
2017-03-27 12:44:39 +00:00
< / div >
2022-07-26 23:18:06 +00:00
< button class = "btn btn-light" type = "button" ng-click = "removePortBinding($index)" >
2022-11-28 02:00:28 +00:00
< pr-icon icon = "'trash-2'" class-name = "'icon-secondary icon-md'" > < / pr-icon >
2017-03-27 12:44:39 +00:00
< / button >
2016-07-06 00:19:09 +00:00
< / div >
2017-03-27 12:44:39 +00:00
<!-- !protocol - actions -->
2016-07-06 00:19:09 +00:00
< / div >
< / div >
<!-- !port - mapping - input - list -->
< / div >
<!-- !port - mapping -->
2018-07-23 09:31:21 +00:00
< div ng-if = "applicationState.endpoint.mode.agentProxy && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'" >
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Deployment < / div >
2018-05-06 07:15:57 +00:00
<!-- node - selection -->
2022-11-02 11:29:26 +00:00
< node-selector model = "formValues.NodeName" endpoint-id = "endpoint.Id" > < / node-selector >
2018-05-06 07:15:57 +00:00
<!-- !node - selection -->
< / div >
2017-05-23 18:56:10 +00:00
<!-- access - control -->
2020-06-09 09:55:36 +00:00
< por-access-control-form form-data = "formValues.AccessControlData" resource-control = "fromContainer.ResourceControl" ng-if = "fromContainer" > < / por-access-control-form >
2017-05-23 18:56:10 +00:00
<!-- !access - control -->
2017-03-27 12:44:39 +00:00
<!-- actions -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Actions < / div >
2019-02-25 00:09:09 +00:00
<!-- autoremove -->
2017-03-27 12:44:39 +00:00
< div class = "form-group" >
2019-02-24 20:48:31 +00:00
< div class = "col-sm-12" >
2022-07-20 00:39:44 +00:00
< por-switch-field
label-class="'col-sm-2'"
checked="config.HostConfig.AutoRemove"
label="'Auto remove'"
on-change="(handleAutoRemoveChange)"
tooltip="'When enabled, Portainer will automatically remove the container when it exits. This is useful when you want to use the container only once.'"
>< / por-switch-field >
2019-02-24 20:48:31 +00:00
< / div >
2019-02-25 00:09:09 +00:00
< / div >
<!-- !autoremove -->
< div class = "form-group" >
2017-03-27 12:44:39 +00:00
< div class = "col-sm-12" >
2020-04-10 21:54:53 +00:00
< button
type="button"
2023-03-03 01:47:10 +00:00
class="btn btn-primary btn-sm !ml-0"
2021-12-02 00:41:05 +00:00
ng-disabled="state.actionInProgress || !formValues.RegistryModel.Image || (!formValues.RegistryModel.Registry & & fromContainer)
2022-08-12 04:47:44 +00:00
|| (fromContainer.IsPortainer & & fromContainer.Name === '/' + config.name)"
2020-04-10 21:54:53 +00:00
ng-click="create()"
button-spinner="state.actionInProgress"
>
2017-11-12 21:39:12 +00:00
< span ng-hide = "state.actionInProgress" > Deploy the container< / span >
< span ng-show = "state.actionInProgress" > Deployment in progress...< / span >
2017-11-12 19:27:28 +00:00
< / button >
2022-01-17 05:53:32 +00:00
< span class = "text-danger" ng-if = "state.formValidationError" style = "margin-left: 5px" > {{ state.formValidationError }}< / span >
2017-03-27 12:44:39 +00:00
< / div >
< / div >
<!-- !actions -->
2016-07-06 00:19:09 +00:00
< / form >
< / rd-widget-body >
< / rd-widget >
< / div >
< / div >
< div class = "row" >
< div class = "col-lg-12 col-md-12 col-xs-12" >
< rd-widget >
2022-11-28 02:00:28 +00:00
< rd-widget-header icon = "settings" title-text = "Advanced container settings" > < / rd-widget-header >
2016-07-06 00:19:09 +00:00
< rd-widget-body >
2017-03-27 12:44:39 +00:00
< ul class = "nav nav-pills nav-justified" >
2018-10-28 03:00:56 +00:00
< li class = "active interactive" > < a data-target = "#command" data-toggle = "tab" > Command & logging< / a > < / li >
2016-10-27 08:33:39 +00:00
< li class = "interactive" > < a data-target = "#volumes" data-toggle = "tab" > Volumes< / a > < / li >
< li class = "interactive" > < a data-target = "#network" data-toggle = "tab" > Network< / a > < / li >
2017-03-27 12:44:39 +00:00
< li class = "interactive" > < a data-target = "#env" data-toggle = "tab" > Env< / a > < / li >
2016-12-25 20:33:14 +00:00
< li class = "interactive" > < a data-target = "#labels" data-toggle = "tab" > Labels< / a > < / li >
2017-03-27 12:44:39 +00:00
< li class = "interactive" > < a data-target = "#restart-policy" data-toggle = "tab" > Restart policy< / a > < / li >
2022-09-04 23:08:38 +00:00
< li class = "interactive" > < a data-target = "#runtime-resources" ng-mouseup = "refreshSlider()" data-toggle = "tab" > Runtime & Resources< / a > < / li >
2020-07-28 07:08:15 +00:00
< li ng-if = "areContainerCapabilitiesEnabled" class = "interactive" > < a data-target = "#container-capabilities" data-toggle = "tab" > Capabilities< / a > < / li >
2016-07-06 00:19:09 +00:00
< / ul >
2023-09-21 11:02:02 +00:00
< div class = "form-horizontal" ng-if = "state.containerIsLoaded" >
2023-09-26 10:54:45 +00:00
<!-- tab - content -->
2023-09-04 18:07:29 +00:00
< div class = "tab-content" >
<!-- tab - command -->
< div class = "tab-pane active" id = "command" >
< docker-create-container-commands-tab
values="formValues.commands"
api-version="applicationState.endpoint.apiVersion"
on-change="(handleCommandsChange)"
>< / docker-create-container-commands-tab >
< / div >
<!-- !tab - command -->
2023-09-21 02:31:00 +00:00
2023-09-04 18:07:29 +00:00
< div class = "tab-pane" id = "volumes" >
2023-09-21 02:31:00 +00:00
< docker-create-container-volumes-tab ng-if = "state.containerIsLoaded" values = "formValues.volumes" on-change = "(onVolumesChange)" allow-bind-mounts = "allowBindMounts" >
< / docker-create-container-volumes-tab >
2023-09-04 18:07:29 +00:00
< / div >
2023-09-21 02:31:00 +00:00
2023-09-04 18:07:29 +00:00
< div class = "tab-pane" id = "network" >
2023-09-21 11:02:02 +00:00
< docker-create-container-network-tab values = "formValues.network" on-change = "(onNetworkChange)" > < / docker-create-container-network-tab >
2023-09-04 18:07:29 +00:00
< / div >
2023-09-21 11:02:02 +00:00
2023-09-04 18:07:29 +00:00
< div class = "tab-pane" id = "labels" >
2023-09-26 10:54:45 +00:00
< docker-create-container-labels-tab values = "formValues.labels" on-change = "(onLabelsChange)" > < / docker-create-container-labels-tab >
2023-09-04 18:07:29 +00:00
< / div >
2023-09-26 10:54:45 +00:00
2023-09-04 18:07:29 +00:00
<!-- tab - env -->
< div class = "tab-pane" id = "env" >
2023-09-21 01:11:18 +00:00
< docker-create-container-env-vars-tab
ng-if="state.containerIsLoaded"
values="formValues.envVars"
on-change="(handleEnvVarsChange)"
>< / docker-create-container-env-vars-tab >
2023-09-04 18:07:29 +00:00
< / div >
<!-- !tab - env -->
2023-09-25 17:40:26 +00:00
2023-09-04 18:07:29 +00:00
< div class = "tab-pane" id = "restart-policy" >
2023-09-25 17:40:26 +00:00
< docker-create-container-restart-policy-tab values = "formValues.restartPolicy" on-change = "(onRestartPolicyChange)" > < / docker-create-container-restart-policy-tab >
2023-05-31 03:08:41 +00:00
< / div >
2023-09-25 17:40:26 +00:00
2023-09-04 18:07:29 +00:00
<!-- tab - runtime - resources -->
< div class = "tab-pane" id = "runtime-resources" >
2023-09-24 12:31:06 +00:00
< docker-create-container-resources-tab
values="formValues.resources"
on-change="(onResourcesChange)"
allow-privileged-mode="allowPrivilegedMode"
is-devices-field-visible="showDeviceMapping"
is-sysctl-field-visible="allowSysctl"
is-init-field-visible="applicationState.endpoint.apiVersion >= 1.37"
is-image-invalid="!formValues.RegistryModel.Image || (!formValues.RegistryModel.Registry & & fromContainer)"
redeploy="(redeployUnlimitedResources)"
is-duplicate="state.mode == 'duplicate'"
validation-data="{
maxMemory: state.sliderMaxMemory,
maxCpu: state.sliderMaxCpu,
}"
>< / docker-create-container-resources-tab >
2023-09-04 18:07:29 +00:00
< / div >
<!-- !tab - runtime - resources -->
<!-- tab - container - capabilities -->
< div class = "tab-pane" id = "container-capabilities" >
2023-09-25 16:36:50 +00:00
< docker-create-container-capabilities-tab values = "formValues.capabilities" on-change = "(onCapabilitiesChange)" > < / docker-create-container-capabilities-tab >
2023-09-04 18:07:29 +00:00
< / div >
<!-- !tab - container - capabilities -->
2018-08-09 08:40:06 +00:00
< / div >
2016-07-06 00:19:09 +00:00
< / div >
< / rd-widget-body >
< / rd-widget >
< / div >
< / div >