Skip to content

An example of how to use Docker on OS X with Vagrant, Ubuntu, and Node.js

Notifications You must be signed in to change notification settings

baseman/base-docker-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

I created this guide because I wanted to have a docker container on Ubuntu that ran a Node.js server.

Initial problems I ran into before creating this guide:

  • The Docker documentation for this doesn't make much sense, is for a very old version of Docker, and uses CentOS.
  • The Docker daemon only works on linux and not OS X or Windows - for this you can setup boot2docker

Getting Started

You will need…

For Windows - you will also need

Creating a docker container

cd /vagrant

sudo docker build -t <your-name>/node .

The . at the end means take all files in the directory and add them to the container to be built.

Running a docker container

sudo docker run -d -i -t baseman/node /bin/bash

You can retrieve the running container id by typing:

sudo docker ps

And then attach to the instance:

sudo docker attach <container id>

You can detach and stop the container instance by typing ‘exit’

Getting the container's logs

First, view the docker containers:

sudo docker ps

Find the CONTAINER_ID by typing the following command:

    sudo docker ps

And then run:

sudo docker logs CONTAINER_ID_HERE

Additional UFW ports

If you need to open additional ports, add:

sudo ufw allow <port number>/tcp

Other Docker Commands

  • List all containers

    sudo docker ps -a -q

  • Remove all containers

    sudo docker rm [$(sudo docker ps -a -q)]

About

An example of how to use Docker on OS X with Vagrant, Ubuntu, and Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%