https://github.com/jansanchez/node-ubuntu
a Dockerfile for Node + Ubuntu Latest
https://github.com/jansanchez/node-ubuntu
docker-image node-js
Last synced: about 2 months ago
JSON representation
a Dockerfile for Node + Ubuntu Latest
- Host: GitHub
- URL: https://github.com/jansanchez/node-ubuntu
- Owner: jansanchez
- Created: 2017-02-20T02:09:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-20T02:17:41.000Z (over 9 years ago)
- Last Synced: 2025-05-15T16:15:54.418Z (about 1 year ago)
- Topics: docker-image, node-js
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# How to use
## Make a Dockerfile
```
FROM ubuntu:latest
MAINTAINER Jan Sanchez, joejansanchez@gmail.com
RUN apt-get update && apt-get install -y \
wget \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
ENV NODE_VERSION 6.9.5
ENV NODE_ARCH x64
ADD https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$NODE_ARCH.tar.xz /tmp/
RUN tar -xJf /tmp/node-v$NODE_VERSION-linux-$NODE_ARCH.tar.xz -C /opt/ && rm /tmp/node-v$NODE_VERSION-linux-$NODE_ARCH.tar.xz
RUN mkdir -p /opt/
RUN mv /opt/node-v$NODE_VERSION-linux-$NODE_ARCH /opt/node
RUN ln -sf /opt/node/bin/node /usr/bin/node
RUN ln -sf /opt/node/bin/npm /usr/bin/npm
```
## Build docker image of Ubuntu + Node
```
docker build -t jansanchez/node-ubuntu .
```
## Run docker image of Ubuntu + Node in a container
```
docker run -it -d jansanchez/node-ubuntu
```
## To go inside the last created container
```
docker exec -it $(docker ps | grep "node" | cut -c1-12) /bin/bash
```
## Kill the last created container
```
docker kill $(docker ps | grep "node" | cut -c1-12)
```
# Other Commands
## list docker images
```
docker images
```
## Build an image
```
docker build -t {newImageName} .
```
## Run a Docker image
```
docker run -p {clientPort}:{serverPort} -d {imageName}
```
## Remove a container
```
docker rm {containerName}
```
## Remove an docker image
```
docker rmi {imageName}
```
## List docker containers
```
docker ps
```
## To go inside the container
```
docker exec -it {containerID} /bin/bash
```
## Kill one or more running containers
```
docker kill {containerID}
```