Skip to content

Instantly share code, notes, and snippets.

@russellcardullo
Last active June 3, 2020 23:51
Show Gist options
  • Save russellcardullo/dca77bde9a9fa8b2206a3085c6edd55d to your computer and use it in GitHub Desktop.
Save russellcardullo/dca77bde9a9fa8b2206a3085c6edd55d to your computer and use it in GitHub Desktop.
Buildkit #1039 Reproduction https://github.com/moby/buildkit/issues/1039

This reproduces moby/buildkit#1039

To reproduce:

  1. vagrant up
  2. vagrant ssh
  3. cd /tmp
  4. /vagrant/build-all-servers.sh

You should observe in the build logs that servers 2+3 are using the base image from server01 instead of what's defined in the Dockerfile.

#!/bin/bash
set -exuo pipefail
cd /tmp/server01/
cat Dockerfile
PROGRESS_NO_TRUNC=1 DOCKER_BUILDKIT=1 docker build \
--progress plain -t test-bk-1:server01 -f Dockerfile .
cd ../server02/
cat Dockerfile
PROGRESS_NO_TRUNC=1 DOCKER_BUILDKIT=1 docker build \
--progress plain -t test-bk:server02 -f Dockerfile .
cd ../server03/
cat Dockerfile
PROGRESS_NO_TRUNC=1 DOCKER_BUILDKIT=1 docker build \
--progress plain -t test-bk:server03 -f Dockerfile .
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
# Setup prerequisites
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
usermod -aG docker vagrant
SHELL
# Write out test Dockerfiles
config.vm.provision "shell", inline: <<-SHELL
mkdir -p /tmp/server01
echo "FROM python:3.6.5" > /tmp/server01/Dockerfile
mkdir -p /tmp/server02
echo "FROM python:3.6.8" > /tmp/server02/Dockerfile
mkdir -p /tmp/server03
echo "FROM python:3.6.9" > /tmp/server03/Dockerfile
SHELL
end
@russellcardullo
Copy link
Author

If I change the script in the Vagrantfile above to add sleep 2 between writing each Dockerfile the problem goes away. Maybe related to moby/buildkit#1368?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment