@@ -157,10 +157,22 @@ var createSaveAndNetworkContainer = flow.series(
157157 } ) ) ,
158158 mw . req ( 'containerInfo' ) . require ( )
159159 . then ( // container create was successful
160- docker . model . startUserContainer ( 'containerInfo' ) ,
161- docker . model . inspectUserContainer ( 'containerInfo' ) ,
162- mw . req ( ) . set ( 'containerInspect' , 'dockerResult' ) ,
163- instances . model . modifySetContainer ( 'containerInspect' , 'dockerHost' ) ,
160+ flow . try (
161+ docker . model . startUserContainer ( 'containerInfo' )
162+ ) . catch (
163+ // we've seen layer limit errors bubble from startContainer
164+ mw . req ( ) . setToErr ( 'containerStartErr' ) ,
165+ instances . model . modifyContainerCreateErr ( 'containerStartErr' )
166+ ) ,
167+ flow . try (
168+ docker . model . inspectUserContainer ( 'containerInfo' ) ,
169+ mw . req ( ) . set ( 'containerInspect' , 'dockerResult' ) ,
170+ instances . model . modifySetContainer ( 'containerInspect' , 'dockerHost' )
171+ ) . catch (
172+ // this logic is to ensure something is set for container inspect
173+ mw . req ( ) . setToErr ( 'containerInspectErr' ) ,
174+ instances . model . modifySetContainerInspectErr ( 'containerInspectErr' )
175+ ) ,
164176 sauron . create ( 'dockerHost' ) ,
165177 sauron . model . attachHostToContainer (
166178 'instance.network.networkIp' ,
@@ -645,7 +657,7 @@ app.put('/instances/:id/actions/start',
645657 // start container
646658 mw . req ( ) . set ( 'dockerHost' , 'instance.container.dockerHost' ) ,
647659 docker . create ( 'dockerHost' ) ,
648- docker . model . startContainer ( 'instance.container' ) ,
660+ docker . model . startUserContainer ( 'instance.container' ) ,
649661 instances . model . inspectAndUpdate ( 'instance.container' , 'dockerHost' ) ,
650662 // update weave
651663 sauron . create ( 'instance.container.dockerHost' ) ,
0 commit comments