diff --git a/changelogs/unreleased/4150-use-AuthorizedKeysCommand-in-Docker-builds.yml b/changelogs/unreleased/4150-use-AuthorizedKeysCommand-in-Docker-builds.yml
new file mode 100644
index 0000000000000000000000000000000000000000..a0704456bd2e6c58e93185523cebd0e2794cf903_Y2hhbmdlbG9ncy91bnJlbGVhc2VkLzQxNTAtdXNlLUF1dGhvcml6ZWRLZXlzQ29tbWFuZC1pbi1Eb2NrZXItYnVpbGRzLnltbA==
--- /dev/null
+++ b/changelogs/unreleased/4150-use-AuthorizedKeysCommand-in-Docker-builds.yml
@@ -0,0 +1,5 @@
+---
+title: Use AuthorizedKeysCommand in Docker builds
+merge_request: 3191
+author:
+type: performance
diff --git a/docker/assets/sshd_config b/docker/assets/sshd_config
index a2e9812d3512ee91b52fbacb00e36e62f33b1a99_ZG9ja2VyL2Fzc2V0cy9zc2hkX2NvbmZpZw==..a0704456bd2e6c58e93185523cebd0e2794cf903_ZG9ja2VyL2Fzc2V0cy9zc2hkX2NvbmZpZw== 100644
--- a/docker/assets/sshd_config
+++ b/docker/assets/sshd_config
@@ -12,6 +12,8 @@
 PrintLastLog no
 PubkeyAuthentication yes
 AuthorizedKeysFile %h/.ssh/authorized_keys /gitlab-data/ssh/authorized_keys
+AuthorizedKeysCommand /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell-authorized-keys-check git %u %k
+AuthorizedKeysCommandUser git
 
 # Fix: User username not allowed because account is locked
 # With "UsePAM yes" the "!" is seen as a password disabled account and not fully locked so ssh public key login works