Friday, March 15, 2019

Basics in Docker


  • Major difference between docker run and docker start is that the former first creates the container and then starts it.
  • To install some application you may need to run the container by root(you may also need to apt-get update to update package list).

    from https://stackoverflow.com/questions/30853247/how-do-i-edit-a-file-after-i-shell-to-a-docker-container
  • You can exec a container not only by container id but also by its name.
  • To  "Copy files/folders between a container and the local filesystem"
    docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH
    docker cp [OPTIONS] SRC_PATH CONTAINER:DEST_PATH
    For example,
    docker cp myFile.txt container_name:/home/work
  • To exit from container without stopping one, ctrl+p and ctrl+q.
  • Run multiple terminals in a single running container:
    docker exec -it <container> bash
  • If you fail to run or start a container with some directory in the host machine bound, doubt the shared drives' setting.
    https://www.v2ex.com/t/527183
  • We can mount multiple volumes or disks by adding --mount options
https://docs.docker.com/storage/bind-mounts/




No comments:

Post a Comment

Writing a post in Markdown in Blogger

Following articles are helpful. * [【令和最新版】Blogger で Markdown を用いて記事を書く方法](https://qiita.com/hoge_fu-ga/items/267ea5ad4f8c120eaeb8) * [Bl...