InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Docker tutorials

  • Docker quick start guide on Mac
  • Docker quick start guide on Ubuntu
  • Docker how to add a user to group docker on Linux
  • Docker container - handy commands
  • How to get docker container IP
  • Run nginx in docker container
  • Ubuntu docker - storage driver aufs not supported error
  • How to find docker host ip on Mac
  • Docker - how to rerun a container with different flags
  • Docker managing images - command line cheat sheet
  • Install nginx and php in docker ubuntu container
 
  • Home
  • > Tutorials
  • > Docker

Docker quick start guide on Mac

By admin on Jan 25, 2016

Docker is an open-source project that automates the deployment of applications inside software containers. Here is Docker quick start guide on Mac.

  1. Install docker toolbox by downloading them from Docker toolbox site.
  2. Once installed open docker quick start terminal by searching it from Mac launchpad.
    mac-launchpad-docker-quick-start-terminalYou may see a new bash shell with something like this:
    ##         .
                      ## ## ##        ==
                   ## ## ## ## ##    ===
               /"""""""""""""""""\___/ ===
          ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
               \______ o           __/
                 \    \         __/
                  \____\_______/
    
    
    docker is configured to use the default machine with IP 192.168.99.100
    For help getting started, check out the docs at https://docs.docker.com
    $ 
  3. Check docker info
    $ docker info
    Containers: 6
    Images: 18
    Server Version: 1.9.1
    Storage Driver: aufs
     Root Dir: /mnt/sda1/var/lib/docker/aufs
     Backing Filesystem: extfs
     Dirs: 30
     Dirperm1 Supported: true
    Execution Driver: native-0.2
    Logging Driver: json-file
    Kernel Version: 4.1.13-boot2docker
    Operating System: Boot2Docker 1.9.1 (TCL 6.4.1); master : cef800b - Fri Nov 20 19:33:59 UTC 2015
    CPUs: 1
    Total Memory: 1.956 GiB
    Name: default
    ID: FESO:CVJC:IZ2V:XTMM:HHCT:AWBE:OUFA:WTCS:6VOZ:IT35:QQR3:RTNW
    Debug mode (server): true
     File Descriptors: 21
     Goroutines: 38
     System Time: 2016-01-25T06:37:31.858289467Z
     EventsListeners: 0
     Init SHA1: 
     Init Path: /usr/local/bin/docker
     Docker Root Dir: /mnt/sda1/var/lib/docker
    Labels:
     provider=virtualbox
  4. Get default VM IP

    $ docker-machine ip default
    192.168.99.100
    
  5. List all docker machines

    $ docker-machine ls
    NAME      ACTIVE   URL          STATE     URL                         SWARM   DOCKER   ERRORS
    default   *        virtualbox   Running   tcp://192.168.99.100:2376           v1.9.1  
    
  6. Download ubuntu image

    $ sudo docker pull ubuntu
    Using default tag: latest
    latest: Pulling from library/ubuntu
    Digest: sha256:457b05828bdb5dcc044d93d042863fba3f2158ae249a6db5ae3934307c757c54
    Status: Image is up to date for ubuntu:latest
    
  7. Run interactive shell on ubuntu image and create a container named ubuntu1

    $ docker run -it --name ubuntu1 ubuntu /bin/bash
    root@2641c6ddab9f:/# ls
    bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
    

    To detach tty without existing shell, use Ctrl-p + Ctrl-q. Otherwise use Ctrl-d.

    To attach it again use

    docker attach [container_id_or_name]
    
  8. List containers

    $ docker ps  #running containers
    $ docker ps -a  #all containers
    
  9. Start/stop containers
    $ docker stop [container_id_or_name]  # stop container
    $ docker rm [container_id_or_name]  # remove container
    $ docker start [container_id_or_name] #start container
    $ docker restart [container_id_or_name] #restart container
    $ docker kill [container_id_or_name] #kill signal to container
    
  10. Print docker env variables

    $ docker-machine env default
    export DOCKER_TLS_VERIFY="1"
    export DOCKER_HOST="tcp://192.168.99.100:2376"
    export DOCKER_CERT_PATH="/Users/user1/.docker/machine/machines/default"
    export DOCKER_MACHINE_NAME="default"
    # Run this command to configure your shell: 
    # eval $(docker-machine env default)
    

    Note that you can run the following from any shell terminal to setup docker env (instead of running docker quick start terminal)

    $ eval $(docker-machine env default)
    

Suggested posts:

  1. Docker how to add a user to group docker on Linux
  2. LXC (Linux Containers) – quick start tutorial on Ubuntu
  3. Mac – find which process is listening on a port
  4. Docker – how to rerun a container with different flags
  5. document querySelector examples
  6. Docker container – handy commands
  7. Mac docker minikube kubernetes – how to get shell access to container
  8. Docker managing images – command line cheat sheet
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Docker, Mac, Mac Command Line, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress