docker cmd¶
docker build¶
docker build --tag panlm/ntnx:app2 .
docker run -d --name app2 -p 5000:5000 app2
docker login -u panlm
docker push panlm/ntnx:app2
docker pull panlm/ntnx:app2
docker run -d --name app2 -p 5000:5000 panlm/ntnx:app2
docker exec -it app2 /bin/bash
docker-buildx-¶
- download binary from https://github.com/docker/buildx/
- check qemu emulators
- build multi arch
- refer: ../../../../WebClip/How to quickly setup an experimental environment to run containers on x86 and AWS Graviton2 based Amazon EC2 instances
- refer: multi-architecture-image
docker image¶
clean¶
samples¶
flask app¶
-
python_app.py
-
Dockerfile
- create repo ../awscli/ecr-cmd
-
build
-
docker run for testing
build-colorapp-¶
-
v1
export AWS_DEFAULT_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document |jq -r '.region') export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) ECR_URL=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${ECR_URL} cd /tmp git clone https://github.com/sanjeevrg89/samplecolorapp.git cd samplecolorapp PROJ_NAME=sample APP_NAME=colorapp ECR_IMAGE_NAME=${ECR_URL}/${PROJ_NAME}/${APP_NAME} aws ecr create-repository \ --repository-name ${PROJ_NAME}/${APP_NAME} docker build . -t ${ECR_IMAGE_NAME}:v1 docker push ${ECR_IMAGE_NAME}:v1
-
v2
ubuntu-based¶
FROM python:2.7
#RUN ["apt-get", "update"]
#RUN ["apt-get", "install", "-y", "vim"]
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 5000
CMD python ./app.py
centos-based¶
FROM centos:7
RUN ["yum", "install", "-y", "epel-release", "gcc", "python-devel", "python2-pip"]
RUN ["rpm", "-Uvh", "https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm"]
RUN ["yum", "install", "-y", "--enablerepo=mysql80-community", "mysql-community-devel"]
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 5000
CMD python ./app.py
docker run¶
docker push¶
docker environment variable¶
https://phoenixnap.com/kb/docker-environment-variables
ENV SPARK_VERSION=3.3.3