14
Containers and Continuous Delivery: Lessons Learned the Hard Way Daniel Bryant @danielbryantuk

London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

Embed Size (px)

Citation preview

Page 1: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

Containers and Continuous Delivery:Lessons Learned the Hard Way

Daniel Bryant @danielbryantuk

Page 2: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

TL;DR

• Container image becomes ‘single binary’

• Adding metadata is essential

• Cultivate ‘mechanical sympathy’

Page 3: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Containers: Expectations versus reality

“DevOps”

Page 4: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Container technology (and CD)

• OS-level virtualisation• cgroups, namespaces, rootfs

• Package and execute software

• Container image == ‘single binary’

Page 5: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Changing the pipeline

Page 6: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

What to put in the Dockerfile

• OS choice• Exposed to OS (often implictly?)• Choose lightweight OS if possible e.g.

Alpine, Debian Jessie

• Configuration?

• Build artefacts

• Java• JDK vs JRE• Oracle vs OpenJDK

• Golang• Statically compiled binary

• Python• Virtualenv

Page 7: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Please talk to the sysadmin people:Their operational knowledge is invaluable

Page 8: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Different dev and test containers?• Separate ‘test’ container?• Test tools• Test data

• Easy to see configuration drift!

• Interesting ONTEST proposal by Alexi Ledenev

http://blog.terranillius.com/post/docker_testing/

Page 9: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Testing: Jenkins Pipeline as Code

Page 10: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Testing: Functional and NFRs• Automate all the things!• Deploy to realistic environments

• Execution (runtime)• Security• Observability

• Evolvability (static)• Scalability

Page 11: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Metadata

• Beware of the ‘latest’ Docker tag

• Metadata is vital• h/t microbadger.com

Page 12: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk | @spoole167 12

Mechanical sympathy: Docker and Java• Watch for cgroup limits (and cgroup awareness)• getAvailableProcessors issue (bugs.openjdk.java.net/browse/JDK-8140793)• Default fork/join thread pool sizes (based from host CPU count)

• Set container memory appropriately • JVM requirements = Heap size (Xmx) + Metaspace + JVM overhead• Account for native thread requirements e.g. thread stack size (Xss)

• Entropy • Host entropy can soon be exhausted by crypto operations

Page 13: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Want to know more?

O’Reilly mini-book coming soon

https://github.com/danielbryantuk/oreilly-docker-java-shopping

Page 14: London CD: "Continuous Delivery with Containers: Lessons Learned the Hard Way"

03/05/2023 @danielbryantuk

Thanks for listening

• Any questions?

• Feel free to contact me• @danielbryantuk• [email protected]