Docker

I am diving in…

Issue: Log into the terminal and start executing docker commands

Solution:

I always started Kitematic and clicked on the ‘Docker CLI’ command. In my version this was on the bottom left of the Kitematic window (OS X version).

This would launch the terminal and be ready to issue docker commands

Alternative:

From the terminal issue the following command: docker-machine env default

This will produce output that will end with:

# Run this command to configure your shell:

# eval $(docker-machine env default)

Execute this: eval $(docker-machine env default) in the terminal and your terminal will be ready to issue commands to the default docker machine

Issue: Ensuring code is picked up from the development folder when running a node application

Solution:

CLI: docker run –name docker_node -d -p 3000:3000 -v $(pwd):/var/www docker_node

Dockerfile:

FROM node:latest

ENV NODE_ENV=development
ENV PORT=3000

COPY . /var/www
WORKDIR /var/www

RUN npm install -g nodemon@latest

RUN npm install

EXPOSE $PORT

CMD [“nodemon”, “-L”, “server.js”]

Advertisements