Find the project you want to create a container for and copy the entire folder and an empty file "Dockerfile" into the same directory. In this example we will copy "aci_app_ro" and "Dockerfile" inside the newly created directory "docker".
$pwd
/root/home
$ls
aci_app_ro Dockerfile
$mkdir docker
$cp aci_app_ro/ docker
$cp Dockerfile docker
Once you have all the files in the "docker" directory edit the "Dockerfile" with the following:
$cd docker
~/docker$ nano Dockerfile
FROM ubuntu:18.04
RUN apt-get update -y
RUN apt-get install -y apt-utils
RUN apt-get install -y python-pip
RUN apt-get install -y python-dev build-essential
COPY aci_app_ro /aci_app_ro
WORKDIR /aci_app_ro
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["oneaciapp.py"]
Save the Dockerfile and build the container:
~/docker$ docker build . --tag aci_app_ro
Sending build context to Docker daemon 2.814MB
Step 1/10 : FROM ubuntu:18.04
---> 2c047404e52d
Step 2/10 : RUN apt-get update -y
---> Using cache
---> 1b7c84406e57
Step 3/10 : RUN apt-get install -y apt-utils
---> Using cache
---> 3297130974f4
Step 4/10 : RUN apt-get install -y python-pip
---> Using cache
---> e718357e701c
Step 5/10 : RUN apt-get install -y python-dev build-essential
---> Using cache
---> 96e1cd0f87a0
Step 6/10 : COPY aci_app_ro /aci_app_ro
---> Using cache
---> 5cfada21415a
Step 7/10 : WORKDIR /aci_app_ro
---> Using cache
---> 1fd61751593f
Step 8/10 : RUN pip install -r requirements.txt
---> Using cache
---> 1423f72bfbb7
Step 9/10 : ENTRYPOINT ["python"]
---> Using cache
---> 8970d0c9c7a8
Step 10/10 : CMD ["oneaciapp.py"]
---> Using cache
---> f5df0cc62b98
Successfully built f5df0cc62b98
Check the you have the docker image in the repository:
~/docker$ docker image ls | grep f5df0cc62b98
aci_app_ro_container latest f5df0cc62b98 2 minutes ago 468MB