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?

  • Docker in Jenkins pipeline fails to run due to invalid environment variable: =
  • EFS volume not mounted on Docker container on Elastic Beanstalk
  • How to run same docker images twice
  • “ImportError: No module named _bsddb” when opening shelve in Docker container
  • Docker rails project
  • docker container fails to start with docker-compose exit status 2, code 128
  • I’ve read about a command

    sudo docker run -name my_first_instance
    

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

  • Docker creates dangling images when no running container exists
  • Docker MySQL Host Volume
  • Can't see output of Docker container
  • Start uwsgi from Docker
  • Dynamically load a Ruby container in Docker
  • run jenkins pipeline agent with sudo
  • 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.