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?
I’ve read about a command
sudo docker run -name my_first_instance
but i can’t find any container name in the Dockerfile.
2 Solutions collect form web for “How to launch a Docker container that i've got from another person?”
dockerfile will create an
image for you that you can launch
containers from. this being said , Follow this:
Create a folder.
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>
You can expose ports in the previous command using
You can list Images via
You can list running containers via
you can list running + exited containers via
docker ps -a
have a look at
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…
docker images shows nothing, it means you have not yet pulled any docker image.