systemctl
우분투를 Docker 컨테이너로 만들어서 사용하면 몇가지 문제점이 있습니다. 그중에서도 불편한 것은 systemctl 명령이 동작하지 않는 점인데요. 매번 설치해주는 것 보다 Dockerfile을 만들고 이미지를 만들어 놓고 사용하는것이 편리합니다.
▼ Docker 파일 생성
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:22.04 | |
ARG DEBIAN_FRONTEND=noninteractive | |
ENV TZ=Asia/Seoul | |
RUN sed -i 's/kr.archive.ubuntu.com/mirror.kakao.com/g' /etc/apt/sources.list | |
RUN apt update \ | |
&& apt install -qq -y init systemd \ | |
&& apt install -qq -y build-essential \ | |
&& apt install -qq -y tzdata \ | |
&& apt install -qq -y vim curl \ | |
&& apt-get clean autoclean \ | |
&& apt-get autoremove -y \ | |
&& rm -rf /var/lib/{apt,dpkg,cache,log} | |
CMD ["/sbin/init"] |
▼ Docker 빌드
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build --tag ubuntu22.04:1.0.0 . |
▼ 컨테이너를 생성하고 접속합니다.

'운영체제 > 도커' 카테고리의 다른 글
[Docker] 몽고 MongoDB 설정 (0) | 2025.03.17 |
---|---|
[Docker] 맥에 Homebrew 로 도커 설치하기 (0) | 2025.03.11 |
[Docker] 도커 볼륨 바인드 마운트 생성과 삭제 (0) | 2025.03.10 |
[Docker] 도커 이미지 푸시하기 (0) | 2025.03.08 |
[Docker] 도커에서 MySQL 영구적인 볼륨 패스워드 컨테이너 설치 (0) | 2022.09.12 |