docker: run mongo db specific version

If you are looking to run a specific version of mongodb in a container, for instance version 3.4

$ sudo docker container run --detach --publish 8081:27017 --name mongo mongo:3.4
Unable to find image 'mongo:3.4' locally
3.4: Pulling from library/mongo
0a01a72a686c: Pull complete 
cc899a5544da: Pull complete 
19197c550755: Pull complete 
716d454e56b6: Pull complete 
0793d4ab2500: Pull complete 
df33e33466d0: Pull complete 
3b2d76901480: Pull complete 
df04584b8696: Pull complete 
44374faf31f3: Pull complete 
fa872588a313: Pull complete 
dc7c21f1f450: Pull complete 
f8ec26dc5fff: Pull complete 
339b4d52030e: Pull complete 
ec82d062b203: Pull complete 
Digest: sha256:d314f7eca9d3f825d091b77c40d2f3c9d6fff4de88dde2962527353476f107ba
Status: Downloaded newer image for mongo:3.4
b88627f055816c14d1102753f23303a25242b1351196e3d5c81c0b6978eedd22

Now look on your browser port 8081

Next you want to list all of your containers

$ sudo docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
b88627f05581        mongo:3.4           "docker-entrypoint.s…"   11 minutes ago      Up 11 minutes       0.0.0.0:8081->27017/tcp   mongo
9fd210ce59f2        nginx               "/docker-entrypoint.…"   15 minutes ago      Up 15 minutes       0.0.0.0:8080->80/tcp      nginx

Containers are self-contained and isolated, which means you can avoid potential conflicts between containers with different system or runtime dependencies

RELATED POST

Veritas Volume Manager: Growing a disk group and expand the filesystem

Validated by Mr Man! Lets start off on node2 [root@node02 ~]# vxdisk list DEVICE TYPE DISK GROUP STATUS sda auto:none…

Virtual Machine Manager: Error starting domain

Starting up the KVM error occurred Error starting domain: Requested operation is not valid: network 'default' is not active Locate…

Git Commands

How to initialize a Git repo: Everything starts from here. The first step is to initialize a new Git repo…

Lab Hack: Raspberry Pi running VMWare ESXi

As strange as the title sounds, yes I am running VMWare ESXi on a Raspberry Pi 4 Model B (4GB)…