How to launch a Docker container that i've got from another person?

I am a Docker-newbie and I’ve got a project from another developer including a Dockerfile. This shall give me the Virtual Machine to continue work with the (nodeJS-) project inside this project folder.

Docker is already installed on my machine.
How can I launch this container now?

  • Postgresql drivers not found when dockerizing TeamCity
  • How to make docker image of host operating system which is running docker itself?
  • Pushing and pulling to/from private docker registry is horribly slow
  • multiple eth configuration using docker
  • PhpMyadmin on Docker/MySQL on host
  • Running rails migrations in docker container sometimes results in ActiveRecord::DuplicateMigrationNameError
  • I’ve read about a command

    sudo docker run -name my_first_instance
    

    but i can’t find any container name in the Dockerfile.

  • Vagrant docker shellinit?
  • docker memory-swap=-1 OOM
  • How can I have nginx in one container and php-fpm in another?
  • sbt-native-packager with Docker and Elastic Beanstalk congifuation
  • Mongodb won't start in Docker container when remote-mounting a volume from host
  • docker registry v2 : get parent image name
  • 2 Solutions collect form web for “How to launch a Docker container that i've got from another person?”

    The dockerfile will create an image for you that you can launch containers from. this being said , Follow this:

    Create a folder.

    Copy dockerfile in the folder

    cd into the folder execute the following command:

    docker build -t <your desired image name> .
    

    This will create an image using directives in the dockerfile in the current folder.

    Now launch a container from the image.

    docker run -d --name <your container name> <imagename from previous step> <optional startup commands>
    

    Useful docker commands:

    You can expose ports in the previous command using -p switch.

    You can list Images via docker images

    You can list running containers via docker ps

    you can list running + exited containers via docker ps -a

    have a look at

    https://hub.docker.com/_/node/

    it is the official repository for NodeJS docker images

    If you want some docker images based on NodeJS, you will need to pull them docker pull my_node_image

    Then you can launch one with such a command

    docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node:4 node your-daemon-or-script.js

    The Dockerfile is just the recipe to build a docker image, for Nginx, Mysql, MongoDb, Redis, WordPress, Spotify, atop, htop…

    If docker images shows nothing, it means you have not yet pulled any docker image.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.