Join our Discord Server
Getting Started

Lab 5: The ‘Pull’ Command

Estimated reading: 2 minutes 29 views

Lab #5: pull Command

The docker-compose pull command pull down the images which is specified under each service of docker-compose file from the docker hub.

Pre-requisite:

Tested Infrastructure

Platform Number of Instance Reading Time
Play with Docker 1 5 min

Pre-requisite

  • Create an account with DockerHub
  • Open PWD Platform on your browser
  • Click on Add New Instance on the left side of the screen to bring up Alpine OS instance on the right side

Assignment

  • Create a docker-compose.yml file
  • Pull down the service images
  • Pull down image of a single service

Create a docker-compose.yml file

version: '3.1'
services:
  #Nginx Service
   webserver:
     image: nginx:alpine
     container_name: webserver
     restart: unless-stopped
     ports:
       - "80:80"
       - "443:443"
   dbserver:
     image: mysql:5.7
     container_name: Mysqldb
     restart: unless-stopped
     ports:
       - "3306:3306"

Pull down the service images

$ docker-compose pull
Pulling webserver ... done
Pulling dbserver  ... done

Checking the images in local

$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
mysql               5.7                 383867b75fd2        2 hours ago         373MB
nginx               alpine              d87c83ec7a66        2 weeks ago         21.2MB

Pull down image of a single service

Before doing pull make sure you have removed the images(docker image rm <Image_name/Image_ID>) which is already pulled.

$ docker-compose pull webserver
Pulling webserver ... done

This pulldown only the webserver service image(nginx:alpine).

Share this Doc

Lab 5: The ‘Pull’ Command

Or copy link

CONTENTS
Join our Discord Server