Docker

Introduction

Commands

Example

Running a Jupyter Tensorflow Notebook Server:

docker run --rm -p 8888:8888 -v "$PWD":/home/jovyan/work jupyter/tensorflow-notebook:latest

Here, ' -p 888:8888 ' maps the machines 8888 port to containers 8888 port. Also, ' -v <machine_path>:<container_path> ' maps the machines working directory to container's path (usually predefined). Here we map ' $PWD ' i.e current directory's path with container's predefined path '/home/jovyan/work'. For more info lookup: jupyter-notebook stacks

Building images [WIP]

Create a dockerfile with image config:

FROM alpine:latest

CMD ["apt-get","install","nfd"]

Build image

$ docker build -t imagename .

Building an image could be hectic if the commands are not ordered properly. Here are some tips:

Running

Running as a daemon and accessing container shell

$ docker run -it -d --name container_name image_name /sbin/init

$ docker exec -it container_name sh

Creating a network

$ docker network create network_name

$ docker run --network network_name --name container_name image_name

Last updated 28 March 2020