반응형
1. Dockerfile 작성
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y cron
RUN apt-get install -y wget
#docker install
RUN mkdir -p /tmp # create folder and cd to folder
WORKDIR /tmp/
RUN wget https://golang.org/dl/go1.15.2.linux-amd64.tar.gz
RUN tar -C /usr/local/ -xzf /tmp/go1.15.2.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="${HOME}/projects/go"
ENV PATH="${PATH}:${GOPATH}/bin"
CMD sleep 100000&&
#bin/bash
2. Docker build
sudo docker build --tag ubuntu:0.1 .
3. Docker image run
sudo docker run -d -it --name ubuntu_test ubuntu:0.1
4. Docker hub에 image push하기
sudo docker push hoseog/ubuntu:0.1
5. Docker hub에서 이미지 가져오기
docker pull <image name>:<tag>
docker pull hoseog/ubuntu:0.1
6. Docker stop
sudo docker stop 7dd8254b0262
반응형