From 0827b039f707daa2572db42b1c603fbf4e706bbb Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Fri, 28 Jun 2024 22:10:35 -0300 Subject: [PATCH] Expose correct port on container creation --- src/faaso.cr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/faaso.cr b/src/faaso.cr index 43bd27e..bdd1987 100644 --- a/src/faaso.cr +++ b/src/faaso.cr @@ -98,7 +98,14 @@ module Faaso conf = Docr::Types::CreateContainerConfig.new( image: tag, hostname: "foo", - host_config: Docr::Types::HostConfig.new + # Port in the container side + exposed_ports: {"3000/tcp" => {} of String => String}, + host_config: Docr::Types::HostConfig.new( + port_bindings: {"3000/tcp" => [Docr::Types::PortBinding.new( + host_port: "3000", # Host port + host_ip: "127.0.0.1", # Host IP + )]} + ) ) # FIXME: name should be unique response = docker_api.containers.create(name: "fungus", config: conf)