AIrflow를 운영할 때 겪는 일반적인 어려움이 무엇일까
Docker Image : 독립적으로 완전하게 만들어진 패키지
Docker Container: 이 docker image를 독립된 환경에서 실행한 것

Virtual Machine의 장단점
장점
단점
각 VM은 자신만의 os를 필요로 함(가상 하드웨어에서 돌아감)
자원을 너무 많이 사용함
소프트웨어를 실행하기 위한 독립적이고 분리된 공간
자체 파일 시스템(Volume)

장점
단점

위 정보와 설치 관련 실행 순서등이 docker file에 기술됨




ARG : docker image를 만들 때 사용되는 변수 지정
env: 컨테이너가 실행될 때 사용되는 환경 변수
user: 컨테이너를 실행할 때 사용할 유저 ID
expose:서비스 사용 포트 번호
run: 빌드시 실행되어야하는 명령들이 지정됨
container가 시작 될 때 실행되어야 하는 명령어를 지정하는데 사용
둘 다 dockerfile에서 여러 번 실행되면 마지막 것만 사용


같이 사용하면 entrypoint가 기본 명령이 됨

docker build --platform linux/amd64 -t hello-world-docker docker bulid를 실행하면 dockerfile에서 run 명령이 실행
docker image ls
docker run hello-world-docker
다른 컴퓨터에서 이 이미지를 실행하고자 하면 docker registry에 등록

dockerhub 접속
create registry
test할 것이니 hello-world-docker, public으로 지정

터미널로 이동하여 다음 명령을 실행
먼저 현재 이미지의 repo 이름을 papalio/hello-world-docker로 변경
docker image ls
docker tag hello-world-docker:latest papalio887/helo-docker:latest
docker image ls
docker login --username=papalio
docker push papalio/hello-world-docker
docker version
docker pull papalio/hello-world-docker
docker images ls
docker run papalio/hello-world-docker
docker version:
docker build -t :
docker push:
docker tag:
docker pull:
docker run:
#hello-world-docker.py
print("hello, docker!")
이 파일을 이미지로 만들고자 함
docker 파일 생성
dockerfile_content = """
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Run hello-world-docker.py when the container launches
CMD ["python", "hello-world-docker.py"]
"""
with open('Dockerfile', 'w') as file:
file.write(dockerfile_content)
이후에
docker build -t hello-world-docker . 이미지 생성

그 다음에 docker registry에 등록하려고 함
Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password
PS C:\Users\dldud\Desktop\python_file\docker_test> docker login --username=papalio
Password:
Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password
PS C:\Users\dldud\Desktop\python_file\docker_test> docker login --username=papalio
Password:
Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password
PS C:\Users\dldud\Desktop\python_file\docker_test> docker login --username=papalio
Password:
Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password
PS C:\Users\dldud\Desktop\python_file\docker_test> docker login --username=papalio
Password:
Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password
PS C:\Users\dldud\Desktop\python_file\docker_test> docker login --username=papalio
Password:
Login Succeeded
PS C:\Users\dldud\Desktop\python_file\docker_test>
docker login --username=docker_user_name 으로 로그인(제발 비밀번호는 외워두자)
tag hello-world-docker:latest papalio/hello-world-docker:latest 으로 tag지정
push papalio/hello-world-docker:latest 명령어로 push

public으로 올라갔기 때문에 다른 이들이 사용도 가능함.

# 순서
docker run ubuntu
docker ps
docker ps - a
docker run -it ubuntu
'''
○ nano
○ apt list
○ apt install nano
○ apt update
○ apt install nano
○ nano
○ apt remove nano
'''




apt install nano를 위해 apt update를 먼저 진행
nano는 에디터(vi같은거)
docker pull mysql/mysql-server:8.0docker run --name=mysql_container mysql/mysql-server:8.0docker logs mysql_container 2>&1 | grep GENERATEDdocker exec -it mysql_container mysql -uroot -pdocker exec -it mysql_container mysql -uroot -p 하고 password 입력
docker logs mysql_container 2>&1 | Select-String "GENERATED ROOT PASSWORD" 명령어로 해야함.
