Manage Linux in Docker containers [locally]

Petr Kostelanský | 10 November 2019
If you use Docker containers for development you have probably encountered how to easily manage containers. So let me tell you a bit about Kitematic.

As I've mentioned above Kitematic is an app made by the Docker team to help you manage Docker containers and I recommend it to you use it also. In general, Kitematic presents running or stopped containers and has a few other features that can help you.

It helps you easily run or stop containers you can also see container logs, watch the preview, run docker CLI or run command line in container.

Docker Kitematic

 

Exec - open PowerShell with Linux terminal of the container. This is for me the easiest way how to start managing Linux in the container or get access into it

Container logs - shows logs from an app running in the container

Web preview - a preview of an app running in the container

 

Most useful Linux Commands

pws (print working directory)
Print current directory name

cd (change directory)

cd ../     //go up from directory 
cd ./dev     //jump in subdirectory dev

ls (list segments)
Print files from current directory

ls -l     //list files and directories in long format
ls -l | grep -i 'word'     //search files in current directory that contains ‘word’ in name (grep -i for case insensitive search)
ls -l | grep --color -i 'word'     //same as above but make colorize search string
ls -l | grep -R 'word'     //recursive search in current directory and all of its subdirectories

find
find files

find / -name \*.json     // find files with .json extension from root

 cat <file-path>
Read file content, open text file

cat appsettings.json
cat | less     //to go trought big file (use q to quit less)

mkdir <directory-name> (make directory)

mkdir MyDirectory     //create directory in the current directory

mv <source> <destination>
To move file to destination directory

mv ./documentations/my-app.pdf .     //this will move pdf file from documentations directory into current directory

mv <old-file> <new-file>
To rename file

mv appsettings.Development.json appsetting.Stage.json

cp <source> <destination>
Copy file

cp ./documentations/my-app.pdf .     //copy into current directory

rm <file-path>
Remove file

Loading ads...