diff --git a/app/models/project.rb b/app/models/project.rb index ed7719ed31c..a3eb7d83e49 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -332,15 +332,15 @@ class Project < ActiveRecord::Base @container_registry_repository ||= begin token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace) url = Gitlab.config.registry.api_url - host = Gitlab.config.registry.host - registry = ContainerRegistry::Registry.new(url, token: token, path: host) + host_port = Gitlab.config.registry.host_port + registry = ContainerRegistry::Registry.new(url, token: token, path: host_port) registry[path_with_namespace] end end def container_registry_repository_url if Gitlab.config.registry.enabled - "#{Gitlab.config.registry.host}/#{path_with_namespace}" + "#{Gitlab.config.registry.host_port}/#{path_with_namespace}" end end diff --git a/app/views/projects/container_registry/index.html.haml b/app/views/projects/container_registry/index.html.haml index f3b2881ce09..6a1e46b14b9 100644 --- a/app/views/projects/container_registry/index.html.haml +++ b/app/views/projects/container_registry/index.html.haml @@ -16,7 +16,7 @@ To start using container images hosted on GitLab you first need to login: %pre %code - docker login #{Gitlab.config.registry.host} + docker login #{Gitlab.config.registry.host_port} %br Then you are free to create and upload a container image with build and push commands: %pre diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index d1fcb053bee..20f920ea854 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -249,9 +249,11 @@ Settings.artifacts['max_size'] ||= 100 # in megabytes Settings['registry'] ||= Settingslogic.new({}) Settings.registry['enabled'] ||= false Settings.registry['host'] ||= "example.com" +Settings.registry['port'] ||= nil Settings.registry['api_url'] ||= "http://localhost:5000/" Settings.registry['key'] ||= nil Settings.registry['issuer'] ||= nil +Settings.registry['host_port'] ||= [Settings.registry['host'], Settings.registry['port']].join(':') # # Git LFS