말랑코딩
vscode에서 원격 서버의 docker container에 접속하기 본문
기존 나의 환경
- 원격서버
- docker 로 작업
- ubuntu 환경
- 툴은 mobaXterm 사용 ---> vscode로 바꾸고 싶음 (.py 등의 파일을 열 수 없어서)
vscode 에서 원격서버의 도커 접속 방법
1. 윈도우에서 vscode 다운로드
https://code.visualstudio.com/download
Download Visual Studio Code - Mac, Linux, Windows
Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.
code.visualstudio.com
2. 윈도우에서 도커 다운로드
https://docs.docker.com/docker-for-windows/install/
Redirecting…
docs.docker.com
3. Remote-Containers라는 extension을 설치
https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
Remote - Containers - Visual Studio Marketplace
Extension for Visual Studio Code - Open any folder or repository inside a Docker container and take advantage of Visual Studio Code's full feature set.
marketplace.visualstudio.com
4. 모두 설치한 이후에 할일
vscode 에서 settings.json 파일 수정해야함
F1 누르고 - setting 입력하면 아래 파일이 뜸. 클릭
위에 내용들은 기존에 있던 내용들이고,
맨 밑에 "remote.SSH.remotePlatform" : { "원격서버IP" : "linux" } 라는 내용만 추가
아래 위치의 config 파일도 수정해줌.
Host User@원격서버IP:포트번호
HostName 포트번호
User 유저네임
Port 포트번호
수정이 완료되고 vscode를 새로 시작
F1 누르고 ssh 검색하면 Remote-SSH:Connect to Host ... 가 뜸. 클릭
select 하라고 뜸. 원격서버 클릭
비밀번호 입력하라고 뜸.
비밀번호 입력
하면 원격서버로 진입 완료
F1 누르고 Remote-container 클릭
현재 start 되어있는 도커 container 목록이 뜸. 선택해서 클릭
도커 환경 내부로 진입 완료
ctrl+shift+~ 눌러서 터미널로 작업도 가능.
'Linux, Docker, Git' 카테고리의 다른 글
[Linux] apt- get update VS apt-get upgrade (0) | 2022.02.15 |
---|---|
[Docker] Dockerfile로 딥러닝 git 코드 한번에 실행시키기 (0) | 2022.02.11 |
[Docker] 도커 레지스트리란? (0) | 2022.01.24 |
[Docker] Dockerfile 작성, 옵션, 빌드 (0) | 2022.01.24 |
[Linux] 명령어 한줄로 마운트(mount)하기 (0) | 2022.01.18 |