Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. @dwilkie dwilkie revised this gist Aug 25, 2016. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion docker-cheat-sheat.md
    Original file line number Diff line number Diff line change
    @@ -45,4 +45,10 @@ Run an image in interactive mode with the command `/bin/bash` mounting the host

    ```
    $ sudo docker run -i -t -v /var/app/current:/usr/src/app/ <image_name> /bin/bash
    ```
    ```

    Run an image in interactive mode with the command `/bin/bash` setting the environments variables `FOO` and `BAR`

    ```
    $ sudo docker run -i -t -e FOO=foo -e BAR=bar <image_name> /bin/bash
    ```
  2. @dwilkie dwilkie revised this gist Aug 25, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions docker-cheat-sheat.md
    Original file line number Diff line number Diff line change
    @@ -39,4 +39,10 @@ Run an image with an ENTRYPOINT command in interactive mode with the command `/b

    ```
    $ sudo docker run --entrypoint /bin/bash -i -t <image_name>
    ```

    Run an image in interactive mode with the command `/bin/bash` mounting the host director `/var/app/current` to the container directory `/usr/src/app`

    ```
    $ sudo docker run -i -t -v /var/app/current:/usr/src/app/ <image_name> /bin/bash
    ```
  3. @dwilkie dwilkie revised this gist Aug 19, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions docker-cheat-sheat.md
    Original file line number Diff line number Diff line change
    @@ -33,4 +33,10 @@ Run an image in interactive mode with the command `/bin/bash` and link the ports

    ```
    $ sudo docker run -i -t --link <docker_container_name>:<docker_container_alias> <image_name> /bin/bash
    ```

    Run an image with an ENTRYPOINT command in interactive mode with the command `/bin/bash`

    ```
    $ sudo docker run --entrypoint /bin/bash -i -t <image_name>
    ```
  4. @dwilkie dwilkie revised this gist Aug 19, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions docker-cheat-sheat.md
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,12 @@ Run an image in a new container daemonized
    $ sudo docker run -d <image_name>
    ```

    Run an image in interactive mode with the command `/bin/bash`

    ```
    $ sudo docker run -i -t <image_name> /bin/bash
    ```

    Run an image in interactive mode with the command `/bin/bash` and link the ports.

    ```
  5. @dwilkie dwilkie revised this gist Aug 15, 2016. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions docker-cheat-sheat.md
    Original file line number Diff line number Diff line change
    @@ -15,4 +15,16 @@ View all processes

    ```
    $ sudo docker ps -a
    ```

    Run an image in a new container daemonized

    ```
    $ sudo docker run -d <image_name>
    ```

    Run an image in interactive mode with the command `/bin/bash` and link the ports.

    ```
    $ sudo docker run -i -t --link <docker_container_name>:<docker_container_alias> <image_name> /bin/bash
    ```
  6. @dwilkie dwilkie created this gist Aug 15, 2016.
    18 changes: 18 additions & 0 deletions docker-cheat-sheat.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    ## Build docker image

    ```
    $ cd /path/to/Dockerfile
    $ sudo docker build .
    ```

    View running processes

    ```
    $ sudo docker ps
    ```

    View all processes

    ```
    $ sudo docker ps -a
    ```