Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker introduction for the beginners

A simple docker introduction

  • Login to see the comments

Docker introduction for the beginners

  1. 1. Introduce DOCKER 2017.05.29 JuneyoungOh <jyoh@i-on.net>
  2. 2. Purpose of presentation - Concept of docker - Image & Container - Get familiar with docker cmd - Modify docker daemon - Writing Dockerfile - docker Pros & Cons - Think how to apply
  3. 3. What is Docker? Host system Individual systems Official : - Virtual environment which is much lighter and faster than before What I felt : - It is Okay to being mess up in the container :D - easy to add/remove new service
  4. 4. Server How we using it
  5. 5. docker system structure LOCAL docker hub Download image Upload image 로컬에 저 장 Generate container form image Update image from container [ image ] - immutable - able to upload to docker hub [ container ] - mutable - unable to upload to docker hub - unless save as an image, all progress can be disappeared
  6. 6. Get familiar with docker cmd 1 : Download and do some work docker pull centos:latest - Download docker image form hub 로부 터 이미지를 - <image name>:<tag name> docker run -d --name=test centos:latest - build a container form image - -d / --detach : run as daemon command - --name : assign a name to container. If do not add this option, have to control container with container ID, which is very annoying docker exec -it test /bin/bash - attach to the container - -i : interactive - -t : tty mode - the last parameter is what to execute on run
  7. 7. Get familiar with docker cmd 2 : Upload the image docker commit test testimg - generate new image from the container - parameter #1 : container name or ID - parameter #2 : new name for the image 1. docker tag testimg juneyoungoh/education:test - assign a tag to the image - parameter #2 : <dockerhub username>/<repo_name>:<tag name> - docker login is required 2. docker push juneyoungoh/education:test - upload new image to the hub - parameter #1 : parameter #2 of step 1
  8. 8. Get familiar with docker cmd 2 : Managing and Debugging [ Image & Container ] List local docker lmages : docker images List local docker containers : docker ps Copy a file to docker container from host system : docker cp <Host file location> <Docker container ID>:<Path inside of the container> Remove the container : docker rm <Container ID> Stop/Start the container : docker stop/start <Container ID> Remove the image : docker rmi <Image ID>
  9. 9. Get familiar with docker cmd 3 : Managing and Debugging [ Debugging ] Case1. Want to watch the container logs in some reason - docker logs <Container ID> Case2. docker daemon became <defunc> state - Have to reboot your system. Since docker daemons parent is 1, there is no other way to fix it.
  10. 10. Modify docker daemon Case A. Have to move docker root from /var/lib to /data. - Have to edit daemon.json (If there is no daemon.json in /etc/docker, you can just generate new one) - daemon.json Official Case B. So I copied the entire linux default, but it do not working at all - stackoverflow answer - Have to remove other elements from the json.
  11. 11. Modify docker daemon :OSX 1. Go to Preferences 2. Go to Advanced Tab and write what we saw in previous page
  12. 12. Writing Dockerfile docker build -t test . - put a tag name after ‘-t’ - Can replace ‘.’ to the directory where the Docker file is Dockerfile ? - Basically a shell script - Define actions to execute - For instance, when I type `docker run`, it will automatically install JDK and Tomcat.
  13. 13. Dockerfile Informations [ Dockerfile Keywords ] - FROM : Every Dockerfile starts with this keyword. Put the image name after the keyword which to be a base image of yours. ex> FROM centos - ARG : When docker build , able to get parameters. You can use something like --build-arg <ARG name>=<value> - ENV : Environment variables for the docker image. i.e> JAVA_HOME, CATALINA_HOME - RUN : Will executed when we `build` - EXPOSE : port to be exposed to the host - VOLUME : Define shared volumes - CMD : Will executed when `docker run`
  14. 14. Using Dockerfile [ Dockerfile ] CASE A. Peter writes a Dokerfile like below. He expected to working since `build` and `run` command succeed. But whe he type `docker ps`, the status is `Exited`. What is wrong with this file? StackOverflow answer
  15. 15. Pros & Cons Pros - Does not effect to host system - Easy to deploy if you have a decent Dockerfile - Image layer system Cons - The man who set the config, should know lot of different system. - It is hard to handle when daemon turns into <defunc> state
  16. 16. Extra. Using Docker hub How to use 1. Login docker hub 2. Create Repository + 3. `docker tag` on local 4. `docker push` on local Question. How to use Dockerfile tabs in GUI 1. It is for paid users 2. In alternative way, you can link your git. ● redmine could be a good sample for free users
  17. 17. References - docker Official - pyrasis - 도커 무작정 따라하기 : Korean document - Sample Docker Hub project - GitHub repos for this presentation

×