๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿณ Docker

(5)
๐Ÿณ Docker * sudo ๊ท€์ฐฎ์•„.. ๋„ˆ๋ฌด ๊ท€์ฐฎ์•„... ์•ˆ ์น˜๊ณ  ์‹ถ์–ด... ๋ฆฌ๋ˆ…์Šค์—์„œ ๋„์ปค๋ฅผ ์‚ฌ์šฉํ•˜๋‹ค๋ณด๋ฉด root ๊ถŒํ•œ์ด ์•„๋‹ˆ๋ฉด ๊ณ„์† root ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜์—ฌ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•ด sudo ํ‚ค์›Œ๋“œ๋ฅผ ๋ถ™์—ฌ์•ผ ํ•œ๋‹ค. Why? docker ๋ช…๋ น์„ ์‚ฌ์šฉํ•  ๋•Œ docker ๋ฐ๋ชฌ์ด root ๊ถŒํ•œ์œผ๋กœ ์‹คํ–‰๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ•ญ์ƒ sudo๋ฅผ ๋ถ™์ธ ํ›„ docker ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ ์ด๋‹ค. ์†”์งํžˆ ๋ช‡๊ธ€์ž ๋˜์ง€๋Š” ์•Š์ง€๋งŒ ์ €๊ฒƒ๋„ ๊ณ„์† ์น˜๋‹ค ๋ณด๋ฉด ๊ท€์ฐฎ๋‹ค.. (์ •๋ง์ž„) ๊ทธ๋ž˜์„œ ์˜ค๋Š˜์€ sudo ํ‚ค์›Œ๋“œ๋ฅผ ์น˜์ง€ ์•Š๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด์„œ docker ๊ทธ๋ฃน์— ๊ณ„์ •์„ ์ถ”๊ฐ€ ํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ๋‹ค! ๊ทธ๋ฃน์— ๊ณ„์ •์„ ์ถ”๊ฐ€ํ•˜๊ธฐ ์‚ฌ์‹ค ํŠน๋ณ„ํ•œ ๋ฐฉ๋ฒ•์ด ์žˆ๋Š”๊ฒŒ ์•„๋‹ˆ๋‹ค. ๊ทธ๋ƒฅ ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žจ? ๋“ค์„ ์‹คํ–‰ํ•  ๋•Œ๋„ sudo๋ฅผ ๋ถ™์ด๋Š”๊ฒŒ ๊ท€์ฐฎ๋‹ค๋ฉด ํ•ด๋‹น ๊ทธ๋ฃน์— ๊ณ„์ •์„ ์ถ”๊ฐ€ํ•ด ์ฃผ๋ฉด ๋œ๋‹ค. $ sudo docker -aG docker $USER -a: ad..
โœ… Solved * [Docker] Unable to open log file /mqtt/logs/mosquitto.log for writing mosquitto ๋กœ๊ทธ๋ฅผ ์ €์žฅํ•˜๋Š” ์œ„์น˜๋ฅผ ๋ฐ”๊พธ์—ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณค ๋™์ž‘์‹œํ‚ค๋ ค๋Š”๋ฐ.. Unable to open log file /mqtt/logs/mosquitto.log for writing ๐Ÿ˜๐Ÿ˜‘ ์•„ ์™œ! ๋˜! ์—๋Ÿฌ! ์™œ ๋ชป์จ!! ์˜ˆ์ƒ์€ ํ–ˆ์ง€๋งŒ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ๊ถŒํ•œ ๋ฌธ์ œ ๋•Œ๋ฌธ์— ์‚ฌ์šฉ์ด ์•ˆ๋˜๋Š” ๊ฒƒ์ด์˜€๋Š”๋ฐ... ๊ถŒํ•œ์ด ์—†์œผ๋‹ˆ ๋‹น์—ฐํžˆ ๊ถŒํ•œ์„ ์ฃผ๋ฉด ๋œ๋‹ค. $ cd ๋กœ๊ทธ๊ฐ€_์ €์žฅ_๋ _๋””๋ ‰ํ† ๋ฆฌ $ sudo touch mosquitto.log $ sudo chmod o+w ./mosquitto.log $ sudo chown MQTT_ํฌํŠธ๋ฒˆํ˜ธ:MQTT_ํฌํŠธ๋ฒˆํ˜ธ /srv/mosquitto/log -R ํ .. ์œ„ ๋ถ€๋ถ„์ค‘์—์„œ /srv/mosquitto/log ์ด ๋ถ€๋ถ„์„ ๋กœ๊ทธ๊ฐ€_์ €์žฅ_๋ _๋””๋ ‰ํ† ๋ฆฌ๋กœ ๋Œ€์ฒด ํ•ด์•ผํ•˜๋Š”์ง€ ์•„๋‹Œ์ง€ ๊นŒ๋ฌต.. ๊ทธ๊ฑด....
๐Ÿณ Docker * ์‹œ์ž‘ ์ „ ๋„์  ๋„์ .. | Docker Documentation Docker run reference Docker runs processes in isolated containers. A container is a process which runs on a host. The host may be local or remote. When an operator executes... docs.docker.com ๋„์ปค์™€ ๊ฐ€์ƒ๋จธ์‹ ์˜ ์ฐจ์ด์  ๋„์ปค ํ˜ธ์ŠคํŠธ์œ„์— ๋„์ปค(๊ฐ€์ƒ ํ•˜๋“œ์›จ์–ด + ์ปค๋„ ์—ญํ• ์„ ๋‹ด๋‹น)์— ์ปจํ…Œ์ด๋„ˆ๋“ค์„ ์—ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ˜•ํƒœ๋กœ ๋„์šด๋‹ค. ๋”ฐ๋ผ์„œ, ๊ฐ ์ปจํ…Œ์ด๋„ˆ๋“ค์ด ๋„์ปค์˜ ๊ฐ€์ƒ ํ•˜๋“œ์›จ์–ด + ์ปค๋„์„ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐ€์ƒ๋จธ์‹  ํ˜ธ์ŠคํŠธ ์œ„์— ๊ฐ€์ƒ๋จธ์‹ ์— ๊ฐ€์ƒ๊ณต๊ฐ„(๊ฐ€์ƒํ•˜๋“œ์›จ์–ด + ์ปค๋„)์„ ๊ฐ ๊ฐ ์ƒ์„ฑํ•œ๋‹ค. ๋”ฐ๋ผ์„œ, ๊ฐ ๊ฐ€์ƒ๊ณต๊ฐ„๋“ค์ด ์„œ๋กœ์˜ ๊ฐ€์ƒ ํ•˜๋“œ..
๐Ÿณ Docker * Timezone(์‹œ๊ฐ„) ์„ค์ •ํ•˜๊ธฐ ! Docker์˜ ๊ธฐ๋ณธ timezone์€ UTC๋กœ ๋˜์–ด์žˆ์–ด ํ•œ๊ตญ์˜ ์‹œ๊ฐ„์œผ๋กœ ์„ค์ •ํ•˜๋ ค๋ฉด KST๋กœ ์ˆ˜์ •์„ ํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค. Timezone์„ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์—ฌ๋Ÿฌ๊ฐ€์ง€๊ฐ€ ์žˆ๋Š”๋ฐ localhost timezone ๋””๋ ‰ํ† ๋ฆฌ ๋งˆ์šดํŠธ Timezone์„ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š” ํŒจํ‚ค์ง€ ์„ค์น˜ ํ›„ ์กฐ์ • etc... localhost timezone ๋””๋ ‰ํ† ๋ฆฌ ๋งˆ์šดํŠธ ๋ณดํ†ต localhost timezone ํด๋”์— ๋งˆ์šดํŠธํ•˜๋Š” ํ˜•์‹์œผ๋กœ ์„ค์ •์„ ์ง„ํ–‰ํ•œ๋‹ค. ๋ฌผ๋ก  host์™€ ์‹œ๊ฐ„๋Œ€๋ฅผ ๋งž์ถฐ์•ผ ํ•œ๋‹ค๋ฉด ์ด ๋ฐฉ๋ฒ•์ด ์˜ฌ๋ฐ”๋ฅธ ๋ฐฉ๋ฒ•์ธ ๊ฒƒ ๊ฐ™์ง€๋งŒ.. ์ด๋ฏธ ๋งŒ๋“ค์–ด์ง„ ์ปจํ…Œ์ด๋„ˆ์— timezone์„ ์ˆ˜์ •ํ•ด์•ผํ•œ๋‹ค๋ฉด ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ด๋ฏธ์ง€ํ™” ํ•˜๊ณ  ๋‹ค์‹œ run ํ•ด์•ผ ํ•˜๋Š” ๋ฒˆ๊ฑฐ๋กœ์šด ์ผ์ด.. ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋ณ„๋กœ ์–ด๋ ค์šด ๊ฒƒ ์—†๋‹ค. ์ผ๋‹จ timezone ํด๋” ์ค‘ ์›ํ•˜๋Š” ์‹œ๊ฐ„๋Œ€๋ฅผ /etc..
๐Ÿณ Docker * ํ•œ๊ธ€ ์„ค์ •, ํ•œ๊ธ€ ๊นจ์ง ํ•ด๊ฒฐํ•˜๊ธฐ ๊ธฐ๋ณธ์ ์œผ๋กœ docker๋Š” bash์ฐฝ ์ด์šฉ ์‹œ ํ•œ๊ธ€ ์ž…๋ ฅ์ด ๋˜์ง€ ์•Š๊ณ  ๋งˆ๊ตฌ๋งˆ๊ตฌ ๊นจ์ ธ์„œ ๋‚˜์˜ค๊ฒŒ ๋œ๋‹ค. ํ•œ๊ธ€ ์ž…๋ ฅ์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” locales ์„ค์ •์„ ํ•ด์ค˜์•ผ ํ•œ๋‹ค. python3์„ ์“ฐ๋ฉด์„œ ํ•œ๊ธ€๋กœ ์ ์–ด ๋†“์€ ์ฃผ์„๋“ค์ด ๋งŽ์€๋ฐ docker์— ํ•œ๊ธ€ ์„ค์ •์„ ํ•ด์ฃผ์ง€ ์•Š์œผ๋ฉด, python ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ ์‹œ์ผฐ์„ ๋•Œ encoding error๊ฐ€ ๋ฐœ์ƒํ•˜๊ฒŒ ๋œ๋‹ค. Install locales ๋‹น์—ฐํžˆ Docker์— ์ ‘์†์„ ํ•œ ์ƒํƒœ๋ผ๊ณ  ์ƒ๊ฐํ•˜์ง€๋งŒ ํ˜น์‹œ ๋ชจ๋ฅด๋‹ˆ ์ผ๋‹จ docker์— ์ ‘์†์„ ํ•œ๋‹ค. $ apt-get install locales ์ ‘์†ํ•œ docker์—์„œ locales๋ฅผ ์„ค์น˜ํ•ด ์ค€๋‹ค. Setting 1. Save environment values export LANGUAGE=ko_KR.UTF-8 export LANG=ko_..