24.01.31 최초 작성
# 필요 패키지 설치
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# docker gpg키 추가
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# docker apt 저장소 추가
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
# docker 설치
sudo apt-get install docker-ce docker-ce-cli containerd.io
# docker 사용할 수 있는 사용자 그룹에 유저 추가
usermod -aG docker <유저 이름>
chmod 666 /var/run/docker.sock
service docker restart
vscode를 연결하기vscode에서 ctrl + shift + p를 통해 팔레트 open
add dev container 입력, 선택

python 3 입력, 3.10-bullseye 선택, .devcontainer 파일 생성됨
Dev Containers: Reopen in Container선택해 시작

.devcontainer/devcontainer.json에서 설정 가능{
"name": "Python 3",
//컨테이너 이미지 이름 설정
"image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// 포트포워딩 설정
// "forwardPorts": [],
// 컨테이너 생성 시 실행하려는 명령어 및 설치하려는 의존성 설정
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// vscode 및 extension 설치 자동화
// "customizations": {},
// 개발환경에서 동작하는 사용자 설정
// "remoteUser": "root"
}
host환경의 vscode에서 새 컨테이너 생성, ip주소 확인
sudo apt install openssh-server로 ssh 설치sudo apt update
sudo apt install openssh-server
sudo service ssh start
172.17.0.4
guest환경에서 생성한 ssh-key를 다음과 같이 등록echo <ssh-key> | tee -a ~/.ssh/authorized_keys
ssh-keygen
cat ~/.ssh/id_rsa.pub
~/.ssh/config에 다음과 같이 입력Host second
HostName <server의 ip>
StrictHostKeyChecking no
IdentityFile ~/.ssh/id_rsa
ssh second를 통해 server접속