First steps with docker

Create a directory to play with.
Create a file called Dockerfile.
Edit this file and write:

FROM ubuntu
RUN touch test.txt && \
    apt-get update && \
    apt-get -y install nano

type the following command to build the container:

docker build -t ubuntu_example .

If you type the following command, you will see the container created:

docker images

Run the container:

docker run -i -t ubuntu_example /bin/bash

Run the container and leave it in foreground:

docker run -d -i -t ubuntu_example /bin/bash

Stop all containers

docker stop $(docker ps -a -q)

Remove all containers

docker rm $(docker ps -a -q)

Remove all images

docker rmi $(docker images -q)

Change name of an image

docker tag image_tag myname/server:latest

Docker login

docker login

Push image to Docker Hub

docker push 

Remove a single container and id

docker ps
docker stop
docker rm 
docker rmi 

Creation of a most «complex» docker container:

FROM ubuntu:trusty

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -yq install \
        curl \
        apache2 \
        libapache2-mod-php5 \
        php5-mysql \
        php5-mcrypt \
        php5-gd \
        php5-curl \
        php-pear \

WORKDIR /var/www/html

RUN apt-get update && apt-get -yq install nano

ADD . /var/www/html

Binding an external port (local) to an internal port (docker)

docker run -d -p 9999:80 ubuntu_juanma /usr/sbin/apache2ctl -D FOREGROUND

We obtain the container_name or uuid

docker ps

Accessing inside a docker container to the terminal, where 83a0172358da is the

docker exec -it 83a0172358da /bin/bash

How to create a desktop icon in Ubuntu 16

Yesterday I had to download a java software called PhpStorm which is used to develop PHP scripts. If you do it right you will make a symbolic link of the executable file in /usr/share/applications, but if you want a desktop icon of this software you have to creta e file with the following text:

[Desktop Entry]

How to start a project using composer

First of all it is obvious that is necessary to hace composer.phar downloaded in our system.

For example, in order to install the laravel framework it is possible to do by two ways:

1. Using the following command:

php composer.phar create-project laravel/laravel laravel

2. Building the composer.json file with the following content:

	"name": "laravel project",
	"description": "test de instalacion de laravel por composer",
	"require": {
		"laravel/laravel": "5.1",
		"phpunit/phpunit": "4.1"
        "config": {
                "disable-tls": true

and executing the command:

php composer.phar install