$ docker run hello-world $ docker run busybox echo "hello from busybox"
$ docker ps -a
$ docker run -it busybox sh
$ docker run -d -P --name static-site prakhar1989/static-site ^ name we want to give ^ this will publish all exposed ports to random ports ^ detach our terminal
$ docker port <container_name> $ docker port static-site
$ docker stop <container_name> $ docker stop static-site
$ docker run -p 8888:80 prakhar1989/static-site
$ docker pull ubuntu:18.04
They have to be named: Dockerfile
Content Example:
FROM python:3
# set a directory for the app
WORKDIR /usr/src/app
# copy all the files to the container
COPY . .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
CMD ["python", "./app.py"]
In order to build our image we need to run this command in the same directory of the Dockerfile: $ docker build -t yourusername/test . ^ path where Dockerfile is. ^ custom tag name
version: "3"
services:
es:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2
container_name: es
environment:
- discovery.type=single-node
ports:
- 9200:9200
volumes:
- esdata1:/usr/share/elasticsearch/data
web:
image: omaryahir/myflaskprojectweb
command: python app.py
depends_on:
- es
ports:
- 5000:5000
volumes:
- ./flask-app:/opt/flask-app
volumes:
esdata1:
driver:loca`