Tampilkan postingan dengan label Docker. Tampilkan semua postingan
Tampilkan postingan dengan label Docker. Tampilkan semua postingan

Instalasi Docker di Centos 7


Instalasi  Docker  di Centos  7 
Tutorial  Linux Indonesia  |  Docker  merupakan  aplikasi  yang membuat sederhana  dan  mudah  untuk menjalankan  aplikasi dalam sebuah  container, seperti  virtual  machine.

Tapi   container  lebih  portabel,  lebih  ramah  pada  sumber  daya dan  tergantung pada sistem  operasi  host.

Instalasi  Docker  di Centos  7


Sudah  banyak  perusahaan  besar  menggunakan docker  untuk   layanan  perusahaan  mereka. 

Pada  panduan  ini, akan membahas  instalasi  docker  dan  konfigurasi  docker menggunakan system  CentOS 7.

Prasyarat 

. 64-bit  CentOS 7
. Menggunakan  akun   non-root dengan hak sudo. Server  CentOS 7  yang  diatur  menggunakan Panduan  Instalasi  CentOS 7.


Pertama  yang  dilakukan, sebelum  instalasi  docker  adalah  update  terlebih  dahulu   system  operasi  anda  menggunakan  perintah di bawah ini.

[root@belajardocker ~]# yum update  -y

Sekarang jalankan perintah ini,  untuk menambahkan repository docker resmi, mengunduh docker terbaru dan menginstall.


[root@belajardocker ~]# curl -fsSL https://get.docker.com/ | sh

Setelah  instalasi  docker,  sekarang jalankan   layanan  docker  daemon menggunakan command  ini.

[root@belajardocker ~]# systemctl start  docker

Veritifikasi bahwa  docker   sudah  berjalan.

[root@belajardocker ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2019-04-13 18:42:56 EDT; 5min ago
     Docs: https://docs.docker.com
 Main PID: 2997 (dockerd)
    Tasks: 10
   Memory: 105.1M
   CGroup: /system.slice/docker.service
           └─2997 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/cont...
 
Apr 13 18:42:49 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:50 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:51 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:51 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:55 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:55 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:56 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:56 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Apr 13 18:42:56 belajardocker.bagol69.com systemd[1]: Started Docker Applicat...
Apr 13 18:42:56 belajardocker.bagol69.com dockerd[2997]: time="2019-04-13T18:...
Hint: Some lines were ellipsized, use -l to show in full.
[root@belajardocker ~]#

Terakhir, pastikan  layanan  docker  dapat berjalan   pada  setiap server  di reboot.

[root@belajardocker ~]# systemctl enable  docker

Secara default, kita hanya  dapat  akses  atau menjalankan  perintah docker  di dalam  user  sudo.


Jika  kita  ingin, menggunakan user  lain  untuk menjalankan docker.  Kita  bisa  menambahkan  user tersebut, ke dalam   group docker.

[root@belajardocker ~]# usermod -aG  docker $User

Kita  dapat  menganti  $User  dengan   user  yang  kita  inginkan,  seperti  command  di bawah ini.

[root@belajardocker ~]# usermod -aG  docker docker1

User  yang bernama  docker1  sudah  bergabung ke dalam  group docker.   dia  dapat  menjalankan  perintah  docker  di dalam user  docker1.

Kita  dapat  melihat  semua  perintah  docker,  menggunakan  command  di  bawah ini.

[root@belajardocker ~]# docker
 
Usage:  docker [OPTIONS] COMMAND
 
A self-sufficient runtime for containers
 
Options:
      --config string      Location of client config files (default
                           "/root/.docker")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level
                           ("debug"|"info"|"warn"|"error"|"fatal")
                           (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default
                           "/root/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default
                           "/root/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default
                           "/root/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit
 
Management Commands:
  builder     Manage builds
  config      Manage Docker configs
  container   Manage containers
  engine      Manage the docker engine
  image       Manage images
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes
 
Commands:
  attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes
 
Run 'docker COMMAND --help' for more information on a command.
[root@belajardocker ~]#

Untuk  melihat  informasi  docker  yang  sudah berhasil  di install di system operasi  kalian, dapat  menggunakan  command  di  bawah ini.


[root@belajardocker ~]# docker info
Containers: 5
 Running: 0
 Paused: 0
 Stopped: 5
Images: 7
Server Version: 18.09.5
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 991.2MiB
Name: belajardocker.bagol69.com
ID: PQYU:3UXQ:42VV:IWH3:RI2D:H6LN:VPTP:U44F:BZHL:2E6H:HGCH:FMZJ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
 
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
[root@belajardocker ~]#

Secara default, ini  menarik  container-container dari  docker  hub. Registri  docker yang  di kelola  oleh docker,  perusahaan  di belakang proyek docker.

Siapa  yang dapat  menyimpan  dan membuat  image Docker merekea  di docker  hub. Sehingga  besar aplikasi dan distribusi  linux yang  anda perlukan. Cukup  menjalankan Container  docker  dari docker hub  atau  buat  image container.

Untuk memeriksa apakah anda  dapat  mengakses dan  mengunduh image  dari  docker  hub,  menggunakan  command  ini.

[root@belajardocker ~]# docker  run  hello-world
 
Hello from Docker!
This message shows that your installation appears to be working correctly.
 
To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.
 
To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash
 
Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/
 
For more examples and ideas, visit:
 https://docs.docker.com/get-started/
 
[root@belajardocker ~]#


Anda  dapat  mencari  image  yang  tersedia  di  docker hub dengan menggunakan  perintah  docker  search. Seperti  command  di  bawah  ini,  untuk mencari  image  centos   yang terbaru.

[root@belajardocker ~]# docker search centos
NAME     DESCRIPTION                     STARS     OFFICIAL   AUTOMATED
centos   The official build of CentOS.   2224      [OK]       
jdeathe/centos-ssh  CentOS-6 6.7 x86_64 / CentOS-7 7.2.1511 x8...   22                   [OK]
jdeathe/centos-ssh-apache-php   CentOS-6 6.7 x86_64 / Apache / PHP / PHP M...   17                   [OK]
million12/centos-supervisor     Base CentOS-7 with supervisord launcher, h...   11                   [OK]
nimmis/java-centos              This is docker images of CentOS 7 with dif...   10                   [OK]
torusware/speedus-centos        Always updated official CentOS docker imag...   8                    [OK]
nickistre/centos-lamp           LAMP on centos setup                            3                    [OK]
 

anda  dapat  mengunduh  image  container yang  tersedia  di  docker hub,  menggunakan  command  seperti  ini.

[root@belajardocker ~]# docker pull  debian

Pada perintah  diatas, saya  akan mengunduh  image  container debian  yang terbaru. 

Jika  anda  ingin mengunduh  image  dengan ketentuan   version,  dapat  menggunakan  command di bawah ini.

[root@belajardocker ~]# docker pull  debian:8.0

Dia  akan  mengunduh  image container debian  dengan release  debian  8.0

Anda  dapat  menjalankan  image  container,  menggunakan command  di bawah ini.

[root@belajardocker ~]# docker  run  -it  debian
root@6acab124da7d:/# exit
exit

Anda  dapat melihat images  container  yang suda  berhasil  di  unduh, menggunakan  command  di bawah ini.

[root@belajardocker ~]# docker  images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
python                2.7                 92c086fc9702        2 weeks ago         914MB
debian                latest              2d337f242f07        2 weeks ago         101MB
ubuntu                latest              94e814e2efa8        4 weeks ago         88.9MB
portainer/portainer   latest              19d07168491a        5 weeks ago         74.1MB
hello-world           latest              fce289e99eb9        3 months ago        1.84kB
shipyard/shipyard     latest              36fb3dc0907d        2 years ago         58.8MB
shipyard/rethinkdb    latest              4841f0ad4547        3 years ago         296MB
[root@belajardocker ~]#
 
 




Kategori

Kategori