diff --git a/docker-compose.yml b/docker-compose.yml
index ea476dbb54..9937c65cf6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -145,7 +145,7 @@ services:
       - "${EMAIL_SERVICE_PORT}:${EMAIL_SERVICE_PORT}"
     environment:
       - APP_ENV=production
-      - PORT=${EMAIL_SERVICE_PORT}
+      - EMAIL_SERVICE_PORT
       - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otelcol:4318/v1/traces
       - OTEL_RESOURCE_ATTRIBUTES=service.name=emailservice
     depends_on:
diff --git a/src/emailservice/email_server.rb b/src/emailservice/email_server.rb
index 268b790fd4..1c4df4e9ff 100644
--- a/src/emailservice/email_server.rb
+++ b/src/emailservice/email_server.rb
@@ -6,6 +6,8 @@
 require "opentelemetry/exporter/otlp"
 require "opentelemetry/instrumentation/sinatra"
 
+set :port, ENV["EMAIL_SERVICE_PORT"]
+
 OpenTelemetry::SDK.configure do |c|
   c.use "OpenTelemetry::Instrumentation::Sinatra"
 end