Skip to main content

Docker



Docker is the company driving the container movement and the only container platform provider to address every application across the hybrid cloud. 


Today’s businesses are under pressure to digitally transform but are constrained by existing applications and infrastructure while rationalizing an increasingly diverse portfolio of clouds, datacenters and application architectures.



 Docker enables true independence between applications and infrastructure and developers and IT ops to unlock their potential and creates a model for better collaboration and innovation.






















docker container run httpd:2.4



But there's a little problem: We should be able to access the defaultindex.html page on that server by visitinghttp://localhost:80/index.html

but when we do that we just get an error that we can't connect to port 80. 

Fortunately, we can solve this by adding a -p flag with some port numbers after it to the runcommand.


docker container run -p 80:80 httpd:2.4



Port 80 is a standard port for handling web requests, but we could map any port on the host to the container. Let's try mapping 9999 on the host to 80 on the container.



docker container run -p 9999:80 httpd:2.4



docker container execcommand lets us run commands against a running container. But before we can run a command, we need to know the ID of the container.


docker container ls

W
$ docker container ls
CONTAINER ID        IMAGE               COMMAND              CREATED
 STATUS                 PORTS                  NAMES
a8c267869b0b        httpd:2.4           "httpd-foreground"   53 seconds ago

Up 52 seconds       0.0.0.0:9999->80/tcp   elegant_noether




Each container gets a unique ID, and Docker also assigns them a random name. You can use either the container ID or the container name whenever you're running a command that needs you to specify a container. In this course, every container you create has the name elegant_noether, so try executing the command below on that container.
Type docker container exec elegant_noether du -mh.




Attaching a Shell to a Container 250 PTS


Running commands is cool, but we can also attach a shell to those containers and browse them just like they were a full operating system — which they kind of are. The -i and -t flags can be passed to theexec command to keep an interactive shell open, and you can specify the shell you want to attach after the container ID. Here we'll attach a standard Bash shell.
docker container exec -it elegant_noether /bin/bash.


We're in! From the perspective of the terminal window we're just navigating a normal Unix system, so any commands we type will run inside of that system. Try typing that same command we just ran with exec from inside the container.
Type du -mh




Installing packages

docker container exec -it elegant_noether /bin/bash

apt-get install -y fortunes

/usr/games/fortune
  1. Placeholder Badge

    Level 2

    Dockerfiles

  2. Placeholder Badge

    Level 3

    Volumes

































Comments

Popular posts from this blog

Microservices Design patterns

What are microservices? Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are Highly maintainable and testable Loosely coupled Independently deployable Organized around business capabilities Owned by a small team The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack. You are developing a server-side enterprise application. It must support a variety of different clients including desktop browsers, mobile browsers and native mobile applications. The application might also expose an API for 3rd parties to consume. It might also integrate with other applications via either web services or a message broker. The application handles requests (HTTP requests and messages) by executing business logic; accessing a database; exchanging messages with other systems; and returni...

GraphQL

What is GraphQL  API Standard invented & open-sourced by Facebook Alternative to  REST API  enables declarative data fetching  exposes single endpoint & responds to queries How it works?  Why Graphql? Improvises performance by reducing the data that is to be transferred over the internet Variety of different frontend frameworks and platforms on client-side Fast development speed & expectation for rapid feature development Why Graphql is better than REST? Flexibility & efficient  No more over /under fetching of data Over fetching : Under fetching: Insightful analytics  Schema serves as contract between client and server CORE CONCEPTS : SDL :SCHEMA DEFINITION LANGUAGE Writing Data with mutations 3 kinds of mutations creating new data updating existing data deleting existing data

Jackson

<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId> jackson-core </artifactId> <version>2.9.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId> jackson-annotations </artifactId> <version>2.9.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId> jackson-databind </artifactId> <version>2.9.6</version> </dependency> CBOR encoded data with Jackson <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-cbor</artifactId> <version>2.9.6</version> </dependency> In order to read and write MessagePack encoded data <dependency> <groupId>org.msgpack</groupId> <artifactId>jackson-dataformat-msgp...