Docker

From Steak Wiki
Revision as of 02:11, 10 September 2019 by Adminguy (talk | contribs) (Created page with "Docker is a type of virtualization for Gnu\Linux that allows processes to share similar resources, without having a full OS for each image. ==General Tips== It always helps t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Docker is a type of virtualization for Gnu\Linux that allows processes to share similar resources, without having a full OS for each image.

General Tips

It always helps to read a book on a subject, and then keep it as a Reference. I have read ``Using Docker By Adrian Mouat. It is a decent book. Not bad.

Here are some general tips:

First off, Docker is 64 bit only for i386 architecture. ARM has a separate build. There is no 32 bit i386, unfortunately.

You will want 'some' RAM. I had 1GB on a P4 machine, and that was not enough. 4GB was enough.

You should always use docker compose. If you read the book above, you will understand why. Docker can run on the command line (commands are somewhat complex for each container), but with a compose file, you can write everything down in a much simpler fashion. Use compose. It's a separate install, currently. Install it. Seriously, just ignore the docker command lines. I consider them useless. More of a red herring for rookies.

One of the benefits of docker, is its simplicity. There are essentially two commands you will ever need to know to use docker. Both must be run as root. One is

#docker (e.g. docker restart container\_name\_here)

. The other is docker-compose (e.g. \

#docker-compose up -d

I think I ripped this saying from what they purport of ZFS, but it applies here as well...

Docker Commands

Here are commands you need to know. Just the necessary ones.

docker-compose up -d 

Starts the containers in the docker compose file, if they aren't already started. the -d detaches from the stdout logging. You don't need to use stdout logging, you can use docker logs, but its there if you want it.

docker ps 

Lists containers running. If one fails to start, you'll see it missing from here

docker logs <containername> 

Gives you some logging output from the container. Often enough to troubleshoot.

docker exec -it <containername> /bin/bash

This will get you in a shell in the docker container. From here you can do what you need to. Most are debian, and need apt-get install less nano or whatever program you are missing. Ping is missing from possibly all containers, so if you want to test via ping, you'll have to apt-get it.

docker-compose restart 

This will restart all containers. However, I don't recommend it. Initting containers can get corrupted this way, and also its much easier to restart a single faulty container via...

docker restart <containername> 

This will restart one single container.

docker cp <containername>:/dir/to/file dest 

You can copy files from local machine to docker, or vice versa with this. Extremely useful.