Skip to content

Instantly share code, notes, and snippets.

@Tanapruk
Last active July 14, 2017 09:01
Show Gist options
  • Save Tanapruk/a47db09bbd2514d2bfecfe32dcc557d4 to your computer and use it in GitHub Desktop.
Save Tanapruk/a47db09bbd2514d2bfecfe32dcc557d4 to your computer and use it in GitHub Desktop.
Docker Workshop

Pull Image

docker pull <imagename>

Watch All Images

docker images

First Init

  • -d = run in background (daemon)
  • -p = map our PC's port 7200 to Docker 3000 port
  • --name = image name docker run -d -p 7200:3000 --name=helloworld <imagename>

See processes

docker ps

See processes including all pass processes

docker ps -a

start

docker start helloworld

stop

docker stop helloworld

remove image

docker rm helloworld

mount

  • when you have some codes that don't want to upload to docker registry.
  • Suffix your command with -v <full path>.

docker compose

  • Incase you have to type a long command like docker run -d -p 7200:3000 -v /Users/xxxxx/Documents/ddddd/workingfolder:/hello trust/helloworld
  • You can replace that command with an .yml file.
  • docker-compose.yml
version: '3.1'

services: 
    helloworld:
        image: trust/helloworld
        ports:
         - 7200:3000
        container_name: helloworld
        volumes:
         - /Users/xxxxx/Documents/ddddd/workingfolder:/hello
    
  • and run with docker-compose up -d within the directory that .yml exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment