stacks
Migrate a stack to another environment(endpoint)
Migrate a stack from an environment(endpoint) to another environment(endpoint). It will re-create the stack inside the target environment(endpoint) before removing the original stack. Access policy: authenticated
post/stacks/{id}/migrate
Path parameters
idinteger required
Stack identifier
Query parameters
endpointIdinteger
Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack.
Request body
Example request
{
"EndpointID": 2,
"Name": "new-stack",
"SwarmID": "jpofkc0i9uo9wtx1zesuk649w"
}Response
Success
Example response
{
"AutoUpdate": {
"Interval": "1m30s",
"JobID": "15",
"Webhook": "05de31a2-79fa-4644-9c12-faa67e5c49f0"
},
"CreatedBy": "admin",
"CreationDate": 1587399600,
"EndpointId": 1,
"EntryPoint": "docker-compose.yml",
"Env": [
{
"name": "name",
"value": "value"
}
],
"GitConfig": {
"ConfigFilePath": "docker-compose.yml",
"ConfigHash": "bc4c183d756879ea4d173315338110b31004b8e0",
"ReferenceName": "refs/heads/branch_name",
"URL": "https://github.com/portainer/portainer.git"
},
"Id": 1,
"Name": "myStack",
"Namespace": "default",
"ProjectPath": "/data/compose/myStack_jpofkc0i9uo9wtx1zesuk649w",
"ResourceControl": {
"AdministratorsOnly": true,
"Id": 1,
"Public": true,
"ResourceId": "617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08",
"SubResourceIds": [
"617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08"
]
},
"SwarmId": "jpofkc0i9uo9wtx1zesuk649w",
"UpdateDate": 1587399600,
"UpdatedBy": "bob"
}