jeudi 28 octobre 2021

kill processes from docker-compose "container_name"

Context : 

follwing a project-name change -> renaming the directory-name/docker-compose.yml the processes that were started by docker-compose were duplicated.

From the new project :

*  impossible to see them.

From docker ps : no process listed

From OS perspective ps aux : process present.


Test 1 : kill them all !

 Step 1 : identify them

ps aux | grep $(echo "$(grep container_name docker-compose.yml | grep -v '#' | awk '{printf("%s\\|", $2)}')grep")


Step 2 : kill -9 them all


ps aux | grep $(echo "$(grep container_name docker-compose.yml | grep -v '#' | awk '{printf("%s\\|", $2)}')grep") | awk '{print $2}' | xargs sudo kill -9


-> result : when restarting docker, they're back :-( 


Test 2 : stop docker + docker-compose start

apparently working, but I lost my container's content...


lundi 11 octobre 2021

Docker : thiner images

(from  GitLab Commit at KubeCon : One Layer Builds (Docker Not Included), by Jason Plum https://gitlab.com/WarheadsSE and Will Christensen)

* use FROM Scratch, instead of FROM <distro> 


 * Explore each layer of a docker image

https://github.com/wagoodman/dive 


* use Buildah : http://buildah.io/ "A tool that facilitates building OCI container images."

mercredi 6 octobre 2021

mardi 5 octobre 2021

Shell tools : shellcheck


  • ShellCheck, a static analysis tool for shell scripts

https://github.com/koalaman/shellcheck



suggests to add this on your makefiles :

check-scripts:
    # Fail if any of these files have warnings
    shellcheck myscripts/*.sh
or this on your CI (here : .travis.yml )
script:
  # Fail if any of these files have warnings
  - shellcheck myscripts/*.sh