title: apt-get error: Version '5:19.03.4~3-0~ubuntu-bionic' for 'docker-ce' was not found
body: <p><a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/" rel="nofollow noreferrer">Documentation</a> 
  provides syntax to install specific version of <code>docker-ce</code>: </p>
  
  <p><code>$ sudo apt-get install docker-ce=&lt;VERSION_STRING&gt; docker-ce-cli=&lt;VERSION_STRING&gt; containerd.io</code></p>
  
  <hr>
  
  <p>On similar line, below <code>dockerfile</code> uses the above syntax:</p>
  
  <pre><code>FROM jenkins/jenkins:lts
  
  ENV DEBIAN_FRONTEND=noninteractive
  
  USER root
  
  ARG DOCKER_GID=497
  
  # Create Docker Group with GID
  # Set default value of 497 if DOCKER_GID set to blank string by Docker compose
  RUN groupadd -g ${DOCKER_GID:-497} docker
  
  # Install base packages for docker, docker-compose &amp; ansible
  # apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA8E81B4331F7F50 &amp;&amp; \
  RUN apt-get update -y &amp;&amp; \
      apt-get -y install bc \
                      gawk \
                      libffi-dev \
                      musl-dev \
                      apt-transport-https \
                      curl \
                      python3 \
                      python3-dev \
                      python3-setuptools \
                      gcc \
                      make \
                      libssl-dev \
                      python3-pip 
  
  # Used at build time but not runtime
  ARG DOCKER_VERSION=5:19.03.4~3-0~ubuntu-bionic
  
  # Install the latest Docker CE binaries and add user `jenkins` to the docker group
  RUN apt-get update &amp;&amp; \
      apt-get -y install apt-transport-https \
      ca-certificates \
      curl \
      gnupg-agent \
      software-properties-common &amp;&amp; \
      curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg &gt; /tmp/dkey; apt-key add /tmp/dkey &amp;&amp; \
      add-apt-repository \
        "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
        $(lsb_release -cs) \
        stable" &amp;&amp; \
      apt-get update &amp;&amp; \
      apt-get -y install docker-ce=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic} \
          docker-ce-cli=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic} \
          containerd.io &amp;&amp; \
      usermod -aG docker jenkins
  
  ARG DOCKER_COMPOSE=1.24.1
  
  # Install docker compose
  RUN curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE:-1.24.1}/docker-compose-$(uname -s)-$(uname -m)" \
      -o /usr/local/bin/docker-compose &amp;&amp; \
      chmod +x /usr/local/bin/docker-compose
  
  RUN pip3 install ansible boto3
  
  # Change to jenkins user
  USER jenkins
  
  # Add jenkins plugin
  COPY plugins.txt /usr/share/jenkins/plugins.txt
  RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt
  </code></pre>
  
  <hr>
  
  <p>fails at line below(on build):</p>
  
  <pre><code>apt-get -y install docker-ce=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic} \
              docker-ce-cli=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic} \
              containerd.io &amp;&amp; \
  </code></pre>
  
  <p>where default values are retrieved from command: <code>apt-cache madison docker-ce | awk 'NR==1{print $3}'</code> in my local docker host</p>
  
  <hr>
  
  <p>where <code>docker-compose build</code> gives below error:</p>
  
  <pre><code>Reading state information...
  E: Version '5:19.03.4~3-0~ubuntu-bionic' for 'docker-ce' was not found
  E: Version '5:19.03.4~3-0~ubuntu-bionic' for 'docker-ce-cli' was not found
  ERROR: Service 'jenkins' failed to build: The command '/bin/sh -c apt-get update &amp;&amp;     apt-get -y install apt-transport-https     ca-certificates     curl     gnupg-agent     software-properties-common &amp;&amp;     curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg &gt; /tmp/dkey; apt-key add /tmp/dkey &amp;&amp;     add-apt-repository       "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")       $(lsb_release -cs)       stable" &amp;&amp;     apt-get update &amp;&amp;     apt-get -y install docker-ce=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic}         docker-ce-cli=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic}         containerd.io &amp;&amp;     usermod -aG docker jenkins' returned a non-zero code: 100
  </code></pre>
  
  <hr>
  
  <p><code>apt-get -y install docker-ce  docker-ce-cli  containerd.io</code> is able to download and install the latest version of <code>ubuntu</code> packages, but why download and install of specific version of <code>ubuntu</code> package fails?</p>
  
  <pre><code>apt-get -y install docker-ce=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic} \
                  docker-ce-cli=${DOCKER_VERSION:-5:19.03.4~3-0~ubuntu-bionic} \
                  containerd.io &amp;&amp; \
  </code></pre>