Having encountered exec format error stacktrace for two times already, I definitely want to log it 😤
First encounter # I got this error when I got a new Mac M1 from my employer. I was using colima as docker desktop replacement for Mac. While working on a feature for a service, I built container image using colima; pushed the image to container registry and tried deploying to dev environment. And saw the exec format error in logs.
Kubernetes Introduction # Build a docker image # Dockerfile default filename FROM base image to be used for container ADD copies files/directories/remote file urls to container filesystem. Tarball and Remote URL (git, http) handling COPY same as ADD without tar and remote url handling CMD kubectl –namespace <DEV|STAGING|PROD> get deployments,pods,svc,ingress
Docker for Java Developers # Basic Docker commands # docker images ls to list docker images docker container ls to list containers Containers and Images # Docker CLI # docker info shows basic docker infor about containers/images/volumes, runtimes, kernal version, OS details, etc docker version client and server version for docker api docker --help list of commands available prefer to use management commands like: docker image ls docker container ls Run a container # docker container run jboss/wildfly download wildfly and run it. this will be run in the same terminal docker container -d run jboss/wildfly run container in background (detached mode) docker container stop containername/containerid to stop container docker container rm containername/id to remove the container docker container run -d --name web jboss/wildfly to run a container with desired name docker container rm -f web stop and remove the container. forced docker container run -it --name web jboss/wildfly bash to start a container named web in interactive mode an log in to bash. exit to exit container docker image ls -aq list all image ids. docker image rm -f $(docker image ls -aq) to remove all images. similarly all containers can be removed docker image tag helloworld:1 helloworld:latest to tag version 1 as latest. we need to explicitly tag an image as latest if we want it to be latest. docker image push helloworld:latest to push image to docker hub -> it wont work. docker image tag helloworld:2 ravikrsingh/helloworld:latest then enter credentials to push image to docker hub docker run -d -p 5000:5000 --restart always --name registry registry:2.6.0. docker image tag helloworld:latest localhost:5000/ravikrsingh20/helloworld:latest. docker image push localhost:5000/ravikrsingh20/helloworld Export ports and attach volumes # docker container run -d --name web -P jboss/wildfly publish the port. Maps localhost:32768 to wildfly’s 8080 port docker container logs web shows all the logs of container named web docker container run -d --name web -p 8085:8080 jboss/wildfly maps localhost:8085 to wildfly 8080 port docker container run -d --name web -p 8085:8080 -v /path/to/source/war/file/webapp.war:/opt/jboss/wildfly/standalone/deployments/webapp.war jboss/wildfly take a war file from local machine and mount it as a point in container. Browse to localhost:8085/webapp to see your webapplication docker container logs containername/id -f to tail logs from docker container Creating a docker image # Reference docs for creating docker file docker build image -t helloworld . build a docker image tagged as helloworld using current directory. docker image build can also be used for docker build. docker history helloworld shows how image is built. docker container run helloworld to run the container. Java docker image # Simple Dockerfile for java: