pub async fn launch_container<'docker, E, S, Vols, Vol>(
        &self,
        docker: &'docker Docker,
        envs: E,
        volumes: Vols,
    ) -> Result<Container<'docker>>
    where
        S: AsRef<str> + Serialize,
        E: AsRef<[S]> + Serialize,
        Vol: AsRef<str>,
        Vols: AsRef<[Vol]>,
    {
        let image = self.find_docker_image(docker).await?;

        // Create a new container running this image
        let vols = volumes.as_ref().iter().map(|v| v.as_ref()).collect();
        let options = ContainerOptions::builder(&image.id)
            .tty(true)
            .env(envs)
            .volumes(vols)
            .auto_remove(false)
            .working_dir("/build")
            // .user("1000")
            .build();
        let container_info = docker
            .containers()
            .create(&options)
            .await
            .wrap_err_with(|| eyre!("Error creating docker container from image {}", image.id))?;

        debug!(container_id = %container_info.id, "Started container");

        let container: Container<'docker> = docker.containers().get(&container_info.id);

        container
            .start()
            .await
            .wrap_err_with(|| eyre!("Error starting docker container from image {}", image.id))?;

        Ok(container)
    }
/// Launch a new docker container with this environment's image, with the working directory
/// pre-set to `/build`
Launch a new docker container with this environment's image, with the working directory
pre-set to `/build`
Launch a new docker container with this environment ' s image with the working directory pre - set to ` / build `
pub async fn launch_container<'docker, E, S, Vols, Vol>(
        &self,
        docker: &'docker Docker,
        envs: E,
        volumes: Vols,
    ) -> Result<Container<'docker>>
    where
        S: AsRef<str> + Serialize,
        E: AsRef<[S]> + Serialize,
        Vol: AsRef<str>,
        Vols: AsRef<[Vol]>,
    {
        let image = self.find_docker_image(docker).await?;
        // Create a new container running this image
        let vols = volumes.as_ref().iter().map(|v| v.as_ref()).collect();
        let options = ContainerOptions::builder(&image.id)
            .tty(true)
            .env(envs)
            .volumes(vols)
            .auto_remove(false)
            .working_dir("/build")
            // .user("1000")
            .build();
        let container_info = docker
            .containers()
            .create(&options)
            .await
            .wrap_err_with(|| eyre!("Error creating docker container from image {}", image.id))?;
        debug!(container_id = %container_info.id, "Started container");
        let container: Container<'docker> = docker.containers().get(&container_info.id);
        container
            .start()
            .await
            .wrap_err_with(|| eyre!("Error starting docker container from image {}", image.id))?;
        Ok(container)
    }
pub async fn launch_container < ' docker , E , S , Vols , Vol > ( & self , docker : & ' docker Docker , envs : E , volumes : Vols , ) -> Result < Container < ' docker > > where S : AsRef < str > + Serialize , E : AsRef < [ S ] > + Serialize , Vol : AsRef < str > , Vols : AsRef < [ Vol ] > , { let image = self . find_docker_image ( docker ) . await ? ; // Create a new container running this image let vols = volumes . as_ref ( ) . iter ( ) . map ( | v | v . as_ref ( ) ) . collect ( ) ; let options = ContainerOptions :: builder ( & image . id ) . tty ( true ) . env ( envs ) . volumes ( vols ) . auto_remove ( false ) . working_dir ( " " ) // .user("1000") . build ( ) ; let container_info = docker . containers ( ) . create ( & options ) . await . wrap_err_with ( | | eyre ! ( " " image id ) ) ? ; debug ! ( container_id container_info id " " ) ; let container : Container < ' docker > = docker . containers ( ) . get ( & container_info . id ) ; container . start ( ) . await . wrap_err_with ( | | eyre ! ( " " image id ) ) ? ; Ok ( container ) }
Launch a new docker container with this environment's image, with the working directory
pre-set to `/build`
Launch a new docker container with this environment ' s image with the working directory pre - set to ` / build `
&self
docker
&'docker Docker
envs
E
volumes
Vols
&self
docker
&'docker Docker
envs
E
volumes
Vols