@@ -230,13 +230,16 @@ FROM vm/ubuntu:18.04
230230
231231MEMORY 2G
232232
233- # Install docker
234- RUN apt- get install curl apt- transport- https ca- certificates software- properties- common
235- RUN curl - fsSL https: // download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
236- RUN add- apt- repository " deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
237- RUN apt update
238- RUN apt- cache policy docker- ce
239- RUN apt install docker- ce
233+ # install the latest version of Docker, as in the official Docker installation tutorial.
234+ RUN apt- get update && \
235+ apt- get install ca- certificates curl gnupg lsb- release && \
236+ sudo mkdir - p / etc/ apt/ keyrings && \
237+ curl - fsSL https: // download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
238+ echo \
239+ " deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \
240+ sudo tee / etc/ apt/ sources .list .d / docker .list > / dev/ null && \
241+ apt- get update && \
242+ apt- get install docker- ce docker- ce- cli containerd .io
240243
241244# Install docker compose
242245RUN curl - L https: // github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
@@ -294,17 +297,18 @@ least 2GB of memory are available.
294297
295298### 3. Install Docker
296299
297- ` RUN apt- get install curl apt- transport- https ca- certificates software- properties- common`
298-
299- ` RUN curl - fsSL https: // download.docker.com/linux/ubuntu/gpg | sudo apt-key add -`
300-
301- ` RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"`
302-
303- ` RUN apt update`
304-
305- ` RUN apt-cache policy docker-ce`
306-
307- ` RUN apt install docker-ce`
300+ ` ` ` Layerfile
301+ # install the latest version of Docker, as in the official Docker installation tutorial.
302+ RUN apt- get update && \
303+ apt- get install ca- certificates curl gnupg lsb- release && \
304+ sudo mkdir - p / etc/ apt/ keyrings && \
305+ curl - fsSL https: // download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
306+ echo \
307+ " deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \
308+ sudo tee / etc/ apt/ sources .list .d / docker .list > / dev/ null && \
309+ apt- get update && \
310+ apt- get install docker- ce docker- ce- cli containerd .io
311+ ` ` `
308312
309313The [instruction](../layerfile-reference/run) will run the given script, and
310314fails the Layerfile if the script fails. In this case, we're using the ` RUN `
0 commit comments