Docker🐳

ToastEggsToastΒ·2021λ…„ 1μ›” 31일
0

Docker

λ„μ»€λŠ” μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ„ μ‹ μ†ν•˜κ²Œ ꡬ좕, ν…ŒμŠ€νŠΈ 및 배포할 수 μžˆλŠ” μ†Œν”„νŠΈμ›¨μ–΄ ν”Œλž«νΌμž…λ‹ˆλ‹€. λ„μ»€λŠ” μ†Œν”„νŠΈμ›¨μ–΄λ₯Ό "μ»¨ν…Œμ΄λ„ˆ" λΌλŠ” ν‘œμ€€ν™”λœ μœ λ‹›μœΌλ‘œ νŒ¨ν‚€μ§•ν•˜λ©°, 이 μ»¨ν…Œμ΄λ„ˆμ—λŠ” 라이브러리, μ‹œμŠ€ν…œ 도ꡬ, μ½”λ“œ, λŸ°νƒ€μž„ λ“± μ†Œν”„νŠΈμ›¨μ–΄λ₯Ό μ‹€ν–‰ν•˜λŠ”λ° ν•„μš”ν•œ λͺ¨λ“  것이 ν¬ν•¨λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

Docker Container

A container is simply another process on your machine that has been isolated from all other processes on the host machine. That isolation leverages kernel namespaces and cgroups, features that have been in Linux for a long time.

μ»¨ν…Œμ΄λ„ˆλž€ 호슀트 OS상에 논리적인 ꡬ획(μ»¨ν…Œμ΄λ„ˆ)을 λ§Œλ“€κ³ , μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜μ„ μž‘λ™μ‹œν‚€κΈ° μœ„ν•΄ ν•„μš”ν•œ λΌμ΄λΈŒλŸ¬λ¦¬λ‚˜ μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜ 등을 ν•˜λ‚˜λ‘œ λͺ¨μ•„, 마치 λ³„λ„μ˜ μ„œλ²„μΈ κ²ƒμ²˜λŸΌ μ‚¬μš©ν•  수 있게 λ§Œλ“  것.

μ»¨ν…Œμ΄λ„ˆ κΈ°μˆ μ„ μ‚¬μš©ν•˜λ©΄ OSλ‚˜ 디렉토리, IP μ£Όμ†Œ λ“±κ³Ό 같은 μ‹œμŠ€ν…œ μžμ›μ„ 마치 각 μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ μ μœ ν•˜κ³  μžˆλŠ” 것 처럼 보이게 ν•  수 μžˆλ‹€. μ»¨ν…Œμ΄λ„ˆλŠ” μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜μ˜ 싀행에 ν•„μš”ν•œ λͺ¨λ“ˆμ„ μ»¨ν…Œμ΄λ„ˆλ‘œ λͺ¨μ„ 수 있기 λ•Œλ¬Έμ—, μ—¬λŸ¬κ°œμ˜ μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‘°ν•©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

Docker Image

When running a container, it uses an isolated filesystem. This custom filesystem is provided by a container image. Since the image contains the container's filesystem, it must contain everything needed to run an application - all dependencies, configuration, scripts, binaries, etc. The image also contains other configuration for the container, such as environment variables, a default command to run, and other metadata.

AWSμ—μ„œλŠ” AMI(Amazone Machine Image)ν˜•νƒœλ‘œ 이미지λ₯Ό κ΄€λ¦¬ν•˜κ³ , Dockerμ—μ„œλŠ” Docker imageν˜•νƒœλ‘œ 이미지λ₯Ό κ΄€λ¦¬ν•©λ‹ˆλ‹€.

도컀 μ΄λ―Έμ§€λž€ μ»¨ν…Œμ΄λ„ˆλ₯Ό μƒμ„±ν•˜κΈ° μœ„ν•΄ ν•„μš”ν•œ 섀계도와 κ°™μŠ΅λ‹ˆλ‹€.
도컀 μ΄λ―Έμ§€λŠ” 도컀 νŒŒμΌμ„ 톡해 μƒμ„±λ˜λ©°, 도컀 νŒŒμΌμ—μ„œ μž‘μ„±ν•œ μ½”λ“œ λ ˆμ΄μ–΄λ“€μ„ 톡해 μ–΄λ–€ λͺ…령을 μˆ˜ν–‰ν•  지 μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

Docker Expose

Add an EXPOSE instruction in the Dockerfile
Use the –expose flag at runtime to expose a port
Use the -p flag or -P flag in the Docker run string to publish a port

Docker Container μ‹€ν–‰μ‹œν‚€κΈ°

Docker Containerλ₯Ό μ‹€ν–‰μ‹œν‚€κΈ° μœ„ν•΄μ„œλŠ” 이미지λ₯Ό λ¨Όμ € λΉŒλ“œν•΄μ€˜μ•Όν•©λ‹ˆλ‹€.
docker build [OPTIONS] PATH | URL | - 둜 이미지 λΉŒλ“œλ₯Ό μ‹€ν–‰ν•΄μ£Όκ³ ,
λΉŒλ“œλœ 이미지λ₯Ό docker run [options] Image[:tag] [command] [arg...]λ₯Ό 톡해 도컀 μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‹€ν–‰μ‹œν‚¬ 수 μžˆμŠ΅λ‹ˆλ‹€.

profile
κ°œλ°œν•˜λŠ” λ°˜μˆ™κ³„λž€ / ν•˜κ³ μ‹Άμ€ 곡뢀λ₯Ό ν•©λ‹ˆλ‹€. λͺ©μ μ€ ν₯λ―Έμž…λ‹ˆλ‹€.

0개의 λŒ“κΈ€