File tree Expand file tree Collapse file tree
cmd/soroban-cli/src/commands/container Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ pub enum Error {
2828
2929 #[ error( "⛔ ️Failed to create container: {0}" ) ]
3030 CreateContainerFailed ( #[ from] bollard:: errors:: Error ) ,
31+
32+ #[ error( "⛔ ️ a container named {0:?} already running" ) ]
33+ ContainerAlreadyRunning ( String ) ,
3134}
3235
3336#[ derive( Debug , clap:: Parser , Clone ) ]
@@ -139,7 +142,18 @@ impl Runner {
139142 } ) ,
140143 config,
141144 )
142- . await ?;
145+ . await
146+ . map_err ( |e| match & e {
147+ bollard:: errors:: Error :: DockerResponseServerError { status_code, .. } => {
148+ if * status_code == 409 {
149+ return Error :: ContainerAlreadyRunning (
150+ self . container_name ( ) . get_internal_container_name ( ) ,
151+ ) ;
152+ }
153+ Error :: CreateContainerFailed ( e)
154+ }
155+ _ => Error :: CreateContainerFailed ( e) ,
156+ } ) ?;
143157
144158 docker
145159 . start_container (
You can’t perform that action at this time.
0 commit comments