Skip to content

Instantly share code, notes, and snippets.

@ParkinT
Forked from caike/Dockerfile
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save ParkinT/f39c71fde819a13b1e7b to your computer and use it in GitHub Desktop.

Select an option

Save ParkinT/f39c71fde819a13b1e7b to your computer and use it in GitHub Desktop.

Revisions

  1. ParkinT revised this gist Oct 10, 2014. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions Notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    In order to connect to a container, you have to find out the PID of the first process in the container.

    ```
    docker inspect --format "{{ .State.Pid }}" <container-id>
    ```

    With that PID you can connect to the container:

    ```
    nsenter --target $PID --mount --uts --ipc --net --pid
    ```
  2. ParkinT revised this gist Oct 10, 2014. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions DockerCLIalias
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # ~/.bash_aliases

    # Kill all running containers.
    alias dockerkill='docker kill $(docker ps -a -q)'

    # Delete all stopped containers.
    alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'

    # Delete all untagged images.
    alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'

    # Delete all stopped containers and untagged images.
    alias dockerclean='dockercleanc || true && dockercleani'
  3. @caike caike created this gist Sep 29, 2014.
    19 changes: 19 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # DOCKER-VERSION 1.2.0
    FROM centos:centos6

    # Enable EPEL for Node.js
    RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
    # Install Node.js and npm
    RUN yum install -y npm

    # Creates a new folder on the container
    VOLUME /src
    # Copies everything from
    # the host /src to the container's /src
    COPY /src /src

    # Installs dependencies
    RUN cd /src; npm install

    EXPOSE 8080
    CMD ["node", "/src/app.js"]