I tried to create a container using dockerfile, but I'm not successful. For loading the application on the docker what files do I need? And what is the build command?
-
Provide more details, what is the problem, what is the error ... Please provide all those details. – Atul Jan 17 '20 at 15:56
-
check this link https://stackoverflow.com/questions/31696439/how-to-build-a-docker-container-for-a-java-application – Marwen Jaffel Jan 17 '20 at 15:57
2 Answers
Docker is a relative new technology and it's quite hard to find suitable documentation for your problem, first of all you will need docker-compose.yaml and Dockerfile, wich are the configuration files. Next you need to access the folder where's your project, and run "docker-compose up --build", for building the project, then "docker-compose down" to stop and "docker-compose up" to start again.

- 11
- 1
Tanta. So, basically you'd need the docker installed in your machine, and a Dockerfile in your project.
I would indicate this step-by-step for your first example of a docker container:
- Enter a folder that you can start a new project
Execute these command (You will ned git (click here to download it) installed):
git clone -b v1 https://github.com/docker-training/node-bulletin-board
cd node-bulletin-board/bulletin-board-app
Create a Dockerfile in the current folder
Paste this following piece of code in your new Dockerfile:
FROM node:6.11.5 WORKDIR /usr/src/app COPY package.json . RUN npm install COPY . . CMD [ "npm", "start" ]
Now you can build and run your all-new container:
docker image build -t bulletinboard:1.0 .
docker container run --publish 8000:8080 --detach --name bb bulletinboard:1.0
So, with these steps, I think you can start to understand how Docker works and how you can introduce this stack in your currently running application. Please, also check docker-compose docs for reference, it will help you.
Thank you.

- 36
- 5