Docker notes #1 by emrebeyler

View this thread on steempeak.com
· @emrebeyler · (edited)
$7.55
Docker notes #1
<center><img src="https://www.docker.com/sites/default/files/vertical.png"></center>
<center><sup><a href="https://www.docker.com/legal/brand-guidelines">The original Docker logo</a></center>

***

I am not a devops engineer means that I am not into the deployment things, however, I want to learn about the Docker. Also I want to utilize it in the development setup on our software team.

Therefore, I have started to learn it from the ground. I will publish my notes about it in the process.


#### General info
***

- Unlike the virtualization, Docker has *containerization*. Containers share the same kernel of the host.

- It's much faster and lightweight compared to virtualization.

- Docker has [public images](https://hub.docker.com/) you can download and use. Example: ```docker run centos``` uses the official image centos. If it's not installed in the host, it will download from the docker hub.

- Docker containers exit automatically after running if there is no running process left.

#### Commands
***

```docker ps```

Shows the running containers

```docker ps -a```

Shows all containers including the exited ones.

```docker rm <container_id_or_name>```

Removes the container. Tip: You don't need to write IDS full, write a couple of chars from the beginning.

Example:

```
➜  ~ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
b26772f74f32        ubuntu:14.04        "/bin/bash"         3 seconds ago       Exited (0) 14 seconds ago                       xenodochial_hoover
2b8393811355        ubuntu:14.04        "/bin/bash"         6 seconds ago       Exited (0) 17 seconds ago                       determined_agnesi
➜  ~ docker rm 2
2
➜  ~ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
b26772f74f32        ubuntu:14.04        "/bin/bash"         11 seconds ago      Exited (0) 23 seconds ago                       xenodochial_hoover
```

```docker images```

Shows the installed images

```docker rmi <image>```

Removes the image. If there is a container running based on the image, you need to stop the container first.

```docker pull image```

Pulls the image from docker hub. It can be also ```username/imagename``` for unofficial images. 

```docker stop <container>```

Stops the running container.

```docker run <container> <command>```

Starts a container and runs the command.

Ex: ```docker run ubuntu:14.04 cat /etc/*release*```

Note: if you want to run in detached, use -d param.

```docker exec <container_id> cat /etc/passwd```

Execute commands on running containers.

```docker run -it <image> ```

Creates a container from the image, runs an interactive TTY. (shell)





👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 27 others
properties (23)
post_id63,980,394
authoremrebeyler
permlinkdocker-notes-1
categorydocker
json_metadata{"users":[],"format":"markdown","links":["https:\/\/www.docker.com\/legal\/brand-guidelines","https:\/\/hub.docker.com\/"],"community":"busy","app":"busy\/2.5.6","image":["https:\/\/www.docker.com\/sites\/default\/files\/vertical.png"],"tags":["docker","programming","containers","busy"]}
created2018-10-10 07:38:33
last_update2018-10-10 07:42:42
depth0
children5
net_rshares5,480,384,197,721
last_payout2018-10-17 07:38:33
cashout_time1969-12-31 23:59:59
total_payout_value5.913 SBD
curator_payout_value1.632 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length2,818
author_reputation319,480,565,467,431
root_title"Docker notes #1"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (91)
@tolgahanuzun ·
$0.03
```docker start $(docker ps -a --format "{{.ID}}")```

Aktif çalışma dizinimdeki containerları kaldırmak için kullandığım bir komut. Bazen kalabalık bir container listesi olunca böyle minik betikler yazmak/kullanmak hoşuma gidiyor. :)
👍  ,
properties (23)
post_id63,981,535
authortolgahanuzun
permlinkre-emrebeyler-docker-notes-1-20181010t080659679z
categorydocker
json_metadata{"app":"steemit\/0.1","tags":["docker"]}
created2018-10-10 08:06:57
last_update2018-10-10 08:06:57
depth1
children1
net_rshares20,717,393,312
last_payout2018-10-17 08:06:57
cashout_time1969-12-31 23:59:59
total_payout_value0.021 SBD
curator_payout_value0.006 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length234
author_reputation14,417,464,439,057
root_title"Docker notes #1"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@emrebeyler ·
güzel trick. ✌️
properties (22)
post_id63,981,657
authoremrebeyler
permlinkre-tolgahanuzun-re-emrebeyler-docker-notes-1-20181010t081006657z
categorydocker
json_metadata{"app":"steemit\/0.1","tags":["docker"]}
created2018-10-10 08:10:09
last_update2018-10-10 08:10:09
depth2
children0
net_rshares0
last_payout2018-10-17 08:10:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length15
author_reputation319,480,565,467,431
root_title"Docker notes #1"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@isnochys ·
One year old !BEER
👍  
properties (23)
post_id80,747,960
authorisnochys
permlinkre-docker-notes-1-20191010t045720z
categorydocker
json_metadata{"app":"beem\/0.21.1"}
created2019-10-10 04:57:27
last_update2019-10-10 04:57:27
depth1
children1
net_rshares0
last_payout2019-10-17 04:57:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length18
author_reputation36,963,899,244,133
root_title"Docker notes #1"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@isnochys ·
_
properties (22)
post_id97,526,847
authorisnochys
permlinkre-re-docker-notes-1-20191010t045720z-20220211t224438z
categorydocker
json_metadata{"app":"beem\/0.24.26"}
created2022-02-11 22:44:42
last_update2022-02-11 22:44:42
depth2
children0
net_rshares0
last_payout2022-02-18 22:44:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1
author_reputation36,963,899,244,133
root_title"Docker notes #1"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@beerlover ·
<div class='pull-right'>https://cdn.steemitimages.com/DQmaHThyECGhEx8tSfHZbiMFRNYjJ35K92cDgiJjkzBUaJo/One%20sip%20of%20BEER%20for%20you.gif<p><sup><a href='https://steem-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br><br> <p> Hey @emrebeyler, here is a little bit of  <code>BEER</code> for you. Enjoy it!</p> </center>
properties (22)
post_id80,747,966
authorbeerlover
permlinkre-docker-notes-1-20191010t045743z
categorydocker
json_metadata{"app":"beem\/0.21.1"}
created2019-10-10 04:57:45
last_update2019-10-10 04:57:45
depth1
children0
net_rshares0
last_payout2019-10-17 04:57:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length365
author_reputation16,011,958,080,429
root_title"Docker notes #1"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000