FileZilla myhome3.war
파일 이동
pwd
cd data
docker image ls
docker container ls
root 전환
cd ~calisws/data
ls
로 war 파일 확인
container 충돌이 나길래
docker container prune
: 모든 작동중인 컨테이너 삭제
근데 안 지워지고 에러가 발생함
docker container ls -a
해보니 nginx 가 남아서 톰캣이 안됨
docker ps -a -q
죽이려는데 안 죽음
docker stop 컨테이너 ID or 이름
docker rm 컨테이너 ID or 이름
입력해주면 삭제 가능
docker run --name tomcat -p 9090:8080 tomcat:9.0
톰캣 입장
docker exec -it tomcat /bin/bash
cd data
docker cp myhome3.war tomcat:/usr/local/tomcat/webapps
docker container restart tomcat
접속 성공!
mkdir exam
vi helloworld
#!/bin/sh
echo "Hello, World!"
vi Dockerfile
FROM ubuntu:16.04
COPY helloworld /usr/local/bin
RUN chmod +x /usr/local/bin/helloworld
CMD ["helloworld"]
esc
후 :wq
저장
docker build . -t mmm
docker container run mmm
https://hub.docker.com/
docker hub repository 생성
docker login
docker image tag mmm calisws/mmm:0.1.0
docker push calisws/mmm:0.1.0
docker pull calisws/mmm:0.1.0
docker container run calisws/mmm:0.1.0
image 가 push 되었다
pwd
mkdir compose1
cd compose1
vi main.go
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("received request")
fmt.Fprintf(w, "Hello Docker!!")
})
log.Println("start server")
server := &http.Server{Addr: ":8080"}
if err := server.ListenAndServe(); err != nil {
log.Println(err)
}
}
vi Dockerfile
FROM golang:1.9
RUN mkdir /echo
COPY main.go /echo
CMD ["go", "run", "/echo/main.go"]
vi docker-compose.yml
version: "3"
services:
echo:
build: .
ports:
- 9000:8080
docker compose up
curl http:127.0.0.1:9000
docker compose down