Install Docker On Mac Os X

Instructions to install DB2 v10.1 on Mac OS X Yosemite: Prerequisite: XCode developer tools must be installed. These can be installed from the Mac App Store. Ensure the following entries are in the /etc/sysctl.conf. Create the file /etc/sysctl.conf if it does not exist. Restart your Mac after creating the file to make the values take effect.

Learn Docker - Installing Docker on Mac OS X. Requirements: OS X 10.8 “Mountain Lion” or newer required to run Docker. While the docker binary can run natively on Mac OS X, to build and host containers you need to run a Linux virtual machine on the box. If we want to use docker on Mac, Docker desktop is the best tool to use. Download Docker on Mac OS X. Go to the docker hub page to get the community edition of the Docker. Click the Get Docker link from the browser or use the command to download the files from Url in the downloads folder. Docker for Mac does not affect previous machines created via Docker Machine, The installation gives you the option to copy containers and images from your local default machine if you have one. You must have a Mac: 2010 or newer, with Intel’s hardware Memory Management Unit (MMU). OS X 10.10.3 Yosemite or newer.

Docker is the most popular container technology nowadays and many developers run it locally on their computers and laptops. Docker can run natively on Ubuntu and some other Linux distributions, but not on Mac OS X yet. In this post we will learn how to run a simple Go RESTful service in Docker on Mac. In our example we will piggy back on a simple RESTful service developed in an earlier posts How To Create A Simple RESTful Service In Go.

Docker installation on Mac OS X

If you do not have Docker (and Docker Machine) installed, please follow official Mac OS X installation instruction.

Creating Docker image

First we need to create a Docker image with our RESTful service.

Docker image is built from Dockerfile. Edit the Dockerfile with your favourite editor so that it has the following content:

This simple Dockerfile tells Docker to:

  1. Pull latest Golang image from Docker Hub
  2. Install github.com/upitau/goinbigdata/examples/hellorest go package with “Hello World” RESTful service
  3. Run the RESTful service
  4. Expose port 8080 used by the RESTful service

Detailed description of Dockerfile commands can be found in official reference.

Now we are ready to build a Docker image:

This tells Docker to build image with name restful-hello from Dockerfile in current directory (denoted by dot).

Output:

We can now see our restful-hello Docker image among others:

Output:

Running Go RESTful service in Docker

When image is created, running Docker container is as simple as:

Output:

This command tells Docker to run a new container based on image restful-hello. Param -d tells Docker to run container as daemon. Param -p maps port 8080 of Docker host to the same port on Docker container. This port mapping is necessary. When we will try to connect to RESTful service later, we will connect to Docker host which, in its turn, will relay our request to Docker container. The output is an id of created container.

Install Docker On Mac Os X 10 11 Download Free

Let’s check that our Docker container is up and running:

Output:

Our RESTful service is up and running, and ready to serve.

Calling restful-hello service

As we noted earlier, to call our service we need to call Docker host. On Linux, Docker host is the same as localhost, but on Mac it is a virtual machine running in VirtualBox. Therefore, the first thing we need to do is to get ip address of Docker host.

Output:

Now, when we know the ip, we can finally call our service:

Output:

Bottom line

Running RESTful service in Docker on Mac OS X requires a bit more effort than running on Ubuntu, but is still quite easy. First, we need to create a Docker image with our service. And then create and run a Docker container based on the image.

Oracle Database Server 12c is an industry-leading relational database server. This Docker Image contains the Oracle Database Server 12 Enterprise Edition running on Oracle Linux 7. This image contains a default database in a multi-tenant configuration with a single pluggable database. We will see the steps of installing the Oracle database using docker in Mac OS in this blog.

Install the docker

Mac Os X 10.7 Download Free

Install the docker first by creating a docker user name and password. If you have a Mac OS you can check my earlier blog to install it in your system. You can refer to the official docker document for installing in another operating system. Start the docker application once it is installed. Use the docker version to check if the docker is running or not.

Get the Oracle database image in your Local

First, get the oracle database image from the docker website after filling the necessary forms and accepting the terms of service for Oracle Database Enterprise Edition. I am using the Oracle 12 Image Oracle database enterprise edition for this tutorial.

Mac Os X Versions

Then use the below commands to pull the oracle database using docker

Run Image on docker

As we want to connect the database from outside the container, start the container with -P or -p option. This option will allow you to forward the port.

The Oracle database server exposes port 1521 for Oracle client connections over SQLNet protocol and port for Oracle XML DB. We can use either SQLPLUS or any other JDBC client to connect to the database server from outside the container.

Install Docker On Mac Os X

We will start the Oracle database server instance by using below “`docker run“` command with port 1521 opened. I am disabling the web console port as I will not be using it.

Here option -p indicates that the ports are allocated by Docker.

Once you run this command, you should be able to see hash generated once it gets executed successfully.

Here oracle-12c-container is the name of the container and quay.io/maksymbilenko/oracle-12 is the Docker image tag.

Check the Status of the container

The Oracle database server is ready to use when the STATUS field shows (healthy) in the output of docker ps command.

Check the Database Alert Logs

The database alert log can be viewed with docker logs <ORACLE_CONTAINER_NAME> command. It will give you various details about different items such as logs location, Buffers used, database versions, etc.

Connecting to the Database Server Within Container

The password to connect to the database with system username is oracle. The database server can be connected to by executing SQL plus command after connecting to the container terminal.

First connect to the docker container bash.

Once the bash shell comes up, we can use the sqlplus comamnd to connect from within the container.

Make sure ORACLE_HOME is defined in the path first.

Connecting to the Database Server From Outside Container

The Oracle database server exposes port 1521 for Oracle client connections over SQLNet protocol and port for Oracle XML DB. We can use either SQLPLUS or any other JDBC client to connect to the database server from outside the container.

Install Docker On Mac Os X Downloads

Now try to connect to this database using system/oracleas User Name Password, xe as sid, 1521 as the port. I have used the DBeaver SQL client software application and a database administration tool to test the connection. It is a great GUI-based tool to connect to SQL as well as NoSQL database. You need to make sure that the oracle client jar is in the classpath before connecting to this database.

As you can see, the test is successful.

Mac Os X Download

References