theonedev/onedev · error · ExplicitException

Loopback address not allowed for destination of Kaniko image

Error message

Loopback address not allowed for destination of Kaniko image build step, please use ip address or host name instead

What it means

BuildImageWithKanikoStep validates its destination image references and rejects any destination pointing to localhost or 127.0.0.1, since the built image must be pushed to a registry reachable from the build environment.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspec/step/BuildImageWithKanikoStep.java:221

		@NotEmpty
		public String getDestinations() {
			return destinations;
		}

		public void setDestinations(String destinations) {
			this.destinations = destinations;
		}

		static List<InputSuggestion> suggestVariables(String matchWith) {
			return BuildSpec.suggestVariables(matchWith, true, true, false);
		}

		@Override
		public String getOptions() {
			var options = new ArrayList<String>();
			for (var destination: StringUtils.splitAndTrim(getDestinations(), " ")) {
				if (destination.contains("localhost") || destination.contains("127.0.0.1"))
					throw new ExplicitException("Loopback address not allowed for destination of Kaniko image build step, please use ip address or host name instead");
				options.add("--destination=" + destination);
			}
			return StringUtils.join(options, " ");
		}
		
	}
	
	@Editable(order=200, name="Export as OCI layout")
	public static class OCIOutput implements Output {

		private static final long serialVersionUID = 1L;

		private String destPath;

		@Editable(name="OCI Layout Directory", description = "Specify relative path under <a href='https://docs.onedev.io/concepts#job-workdir' target='_blank'>job working directory</a> to store OCI layout")
		@Interpolative(variableSuggester="suggestVariables")
		@Path(Path.Type.RELATIVE)
		@NoSpace

View on GitHub (pinned to d44925c47c)

Solutions

  1. Replace localhost/127.0.0.1 in the destination with the registry's IP address or host name.
  2. Use the container registry service name or an externally resolvable registry URL.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server-core/src/main/java/io/onedev/server/buildspec/step/BuildImageWithKanikoStep.java:221 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/7d2b3d911837c291. Report an issue: GitHub.