コード例 #1
0
ファイル: DroneService.cs プロジェクト: n0bis/healthydrone
        public async Task <SaveDockerResponse> CreateAndStartContainer(Drone drone)
        {
            if (await _droneRepository.FindByDroneIdAsync(drone.Id) != null)
            {
                return(new SaveDockerResponse($"Drone: {drone.Id} already exsits"));
            }

            var port      = GetAvailablePort();
            var container = await _dockerClient.Containers.CreateContainerAsync(new CreateContainerParameters {
                Image        = "dronesimulator:latest",
                ExposedPorts = new Dictionary <string, EmptyStruct>
                {
                    { "80", default }
                },